Skip to content

Commit

Permalink
feat: support expand group
Browse files Browse the repository at this point in the history
  • Loading branch information
walkerkay authored and HandsomeButterball committed May 28, 2020
1 parent ac3d6ab commit e371cb0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 29 deletions.
2 changes: 1 addition & 1 deletion packages/gantt/src/class/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class GanttGroupInternal {
origin: GanttGroup;
items: GanttItemInternal[];
mergedItems: GanttItemInternal[][];
expand: boolean;
expand = true;

constructor(group: GanttGroup) {
this.id = group.id;
Expand Down
1 change: 1 addition & 0 deletions packages/gantt/src/gantt-ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface GanttRef {
styles: GanttStyles;
draggable?: boolean;
linkable?: boolean;
detectChanges(): void;
}

export const GANTT_REF_TOKEN = new InjectionToken<GanttRef>('GANTT_REF_TOKEN');
20 changes: 1 addition & 19 deletions packages/gantt/src/table/gantt-table.component.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
import {
Component,
OnInit,
ElementRef,
ChangeDetectionStrategy,
Input,
EventEmitter,
Output,
ChangeDetectorRef,
NgZone,
OnChanges,
OnDestroy,
SimpleChanges,
HostBinding,
ContentChild,
TemplateRef,
ContentChildren,
QueryList
} from '@angular/core';
import { Component, HostBinding, TemplateRef, QueryList, Input } from '@angular/core';
import { GanttItemInternal, GanttGroupInternal } from '../class';
import { GanttTableColumnComponent } from './column/column.component';

Expand Down
2 changes: 1 addition & 1 deletion packages/gantt/src/table/group/group.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
</div>
</ng-template>
</div>
<div [hidden]="isCollapse">
<div [hidden]="!group.expand">
<ng-content></ng-content>
</div>
16 changes: 8 additions & 8 deletions packages/gantt/src/table/group/group.component.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { Component, OnInit, TemplateRef, Input, ViewChild, ElementRef, HostBinding } from '@angular/core';
import { GanttGroup } from '../../class/group';
import { Component, OnInit, TemplateRef, Input, ViewChild, ElementRef, HostBinding, Inject } from '@angular/core';
import { GanttGroupInternal } from '../../class/group';
import { GANTT_REF_TOKEN, GanttRef } from '../../gantt-ref';

@Component({
selector: 'gantt-table-group',
templateUrl: './group.component.html',
templateUrl: './group.component.html'
})
export class GanttTableGroupComponent implements OnInit {
@Input() group: GanttGroup;
@Input() group: GanttGroupInternal;

@Input() groupHeader: TemplateRef<any>;

@Input() groupHeaderTitle: TemplateRef<any>;

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

public isCollapse = false;

constructor(public elementRef: ElementRef<HTMLDivElement>) {}
constructor(public elementRef: ElementRef<HTMLDivElement>, @Inject(GANTT_REF_TOKEN) public ganttRef: GanttRef) {}

ngOnInit() {}

collapseGroup() {
this.isCollapse = !this.isCollapse;
this.group.expand = !this.group.expand;
this.ganttRef.detectChanges();
}
}

0 comments on commit e371cb0

Please sign in to comment.