Skip to content

Commit e371cb0

Browse files
walkerkayHandsomeButterball
authored andcommitted
feat: support expand group
1 parent ac3d6ab commit e371cb0

File tree

5 files changed

+12
-29
lines changed

5 files changed

+12
-29
lines changed

packages/gantt/src/class/group.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class GanttGroupInternal {
1212
origin: GanttGroup;
1313
items: GanttItemInternal[];
1414
mergedItems: GanttItemInternal[][];
15-
expand: boolean;
15+
expand = true;
1616

1717
constructor(group: GanttGroup) {
1818
this.id = group.id;

packages/gantt/src/gantt-ref.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface GanttRef {
88
styles: GanttStyles;
99
draggable?: boolean;
1010
linkable?: boolean;
11+
detectChanges(): void;
1112
}
1213

1314
export const GANTT_REF_TOKEN = new InjectionToken<GanttRef>('GANTT_REF_TOKEN');

packages/gantt/src/table/gantt-table.component.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
1-
import {
2-
Component,
3-
OnInit,
4-
ElementRef,
5-
ChangeDetectionStrategy,
6-
Input,
7-
EventEmitter,
8-
Output,
9-
ChangeDetectorRef,
10-
NgZone,
11-
OnChanges,
12-
OnDestroy,
13-
SimpleChanges,
14-
HostBinding,
15-
ContentChild,
16-
TemplateRef,
17-
ContentChildren,
18-
QueryList
19-
} from '@angular/core';
1+
import { Component, HostBinding, TemplateRef, QueryList, Input } from '@angular/core';
202
import { GanttItemInternal, GanttGroupInternal } from '../class';
213
import { GanttTableColumnComponent } from './column/column.component';
224

packages/gantt/src/table/group/group.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
</div>
2222
</ng-template>
2323
</div>
24-
<div [hidden]="isCollapse">
24+
<div [hidden]="!group.expand">
2525
<ng-content></ng-content>
2626
</div>
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
import { Component, OnInit, TemplateRef, Input, ViewChild, ElementRef, HostBinding } from '@angular/core';
2-
import { GanttGroup } from '../../class/group';
1+
import { Component, OnInit, TemplateRef, Input, ViewChild, ElementRef, HostBinding, Inject } from '@angular/core';
2+
import { GanttGroupInternal } from '../../class/group';
3+
import { GANTT_REF_TOKEN, GanttRef } from '../../gantt-ref';
34

45
@Component({
56
selector: 'gantt-table-group',
6-
templateUrl: './group.component.html',
7+
templateUrl: './group.component.html'
78
})
89
export class GanttTableGroupComponent implements OnInit {
9-
@Input() group: GanttGroup;
10+
@Input() group: GanttGroupInternal;
1011

1112
@Input() groupHeader: TemplateRef<any>;
1213

1314
@Input() groupHeaderTitle: TemplateRef<any>;
1415

1516
@HostBinding('class.gantt-table-group') ganttTableGroupClass = true;
1617

17-
public isCollapse = false;
18-
19-
constructor(public elementRef: ElementRef<HTMLDivElement>) {}
18+
constructor(public elementRef: ElementRef<HTMLDivElement>, @Inject(GANTT_REF_TOKEN) public ganttRef: GanttRef) {}
2019

2120
ngOnInit() {}
2221

2322
collapseGroup() {
24-
this.isCollapse = !this.isCollapse;
23+
this.group.expand = !this.group.expand;
24+
this.ganttRef.detectChanges();
2525
}
2626
}

0 commit comments

Comments
 (0)