diff --git a/.angulardoc.json b/.angulardoc.json new file mode 100644 index 00000000..c824efeb --- /dev/null +++ b/.angulardoc.json @@ -0,0 +1,4 @@ +{ + "repoId": "e269ef2e-9a71-4aa1-8085-f4a738a9cfef", + "lastSync": 0 +} \ No newline at end of file diff --git a/example/src/app/examples/examples.component.html b/example/src/app/examples/examples.component.html index dadc31b3..4b158751 100644 --- a/example/src/app/examples/examples.component.html +++ b/example/src/app/examples/examples.component.html @@ -1 +1,10 @@ - + + + + {{ row.origin.title }} + + + + {{ group.title }} + + diff --git a/packages/gantt/src/gantt-upper.ts b/packages/gantt/src/gantt-upper.ts index ac5ebe44..8eac17d5 100644 --- a/packages/gantt/src/gantt-upper.ts +++ b/packages/gantt/src/gantt-upper.ts @@ -1,4 +1,14 @@ -import { Input, TemplateRef, Output, EventEmitter, ContentChild, ElementRef, HostBinding } from '@angular/core'; +import { + Input, + TemplateRef, + Output, + EventEmitter, + ContentChild, + ElementRef, + HostBinding, + ContentChildren, + QueryList, +} from '@angular/core'; import { GanttItem, GanttGroup, @@ -12,6 +22,7 @@ import { GanttView, GanttViewOptions } from './views/view'; import { createViewFactory } from './views/factory'; import { GanttDate } from './utils/date'; import { Subject, fromEvent } from 'rxjs'; +import { GanttTableColumnComponent } from './table/column/column.component'; const defaultStyles = { lineHeight: 55, @@ -45,9 +56,11 @@ export abstract class GanttUpper { @Output() dragEnded = new EventEmitter(); - @ContentChild('barTemplate', { static: true }) barTemplate: TemplateRef; + @ContentChild('bar', { static: true }) barTemplate: TemplateRef; + + @ContentChild('group', { static: true }) groupTemplate: TemplateRef; - @ContentChild('groupTemplate', { static: true }) groupTemplate: TemplateRef; + @ContentChildren(GanttTableColumnComponent) columns: QueryList; public view: GanttView; diff --git a/packages/gantt/src/gantt.module.ts b/packages/gantt/src/gantt.module.ts index d58edf7a..ab4bf3f8 100644 --- a/packages/gantt/src/gantt.module.ts +++ b/packages/gantt/src/gantt.module.ts @@ -6,10 +6,13 @@ import { GanttContainerComponent } from './layout/gantt-container.component'; import { GanttSideComponent } from './layout/gantt-side.component'; import { GanttFlatComponent } from './flat/gantt-flat.component'; import { GanttBarComponent } from './bar/bar.component'; +import { GanttTableColumnComponent } from './table/column/column.component'; +import { GanttTableGroupComponent } from './table/group/group.component'; +import { GanttTableItemsComponent } from './table/items/items.component'; @NgModule({ imports: [CommonModule], - exports: [GanttTableComponent, GanttFlatComponent], + exports: [GanttTableComponent, GanttFlatComponent, GanttTableColumnComponent], declarations: [ GanttTableComponent, GanttFlatComponent, @@ -17,6 +20,9 @@ import { GanttBarComponent } from './bar/bar.component'; GanttContainerComponent, GanttCalendarComponent, GanttBarComponent, + GanttTableColumnComponent, + GanttTableGroupComponent, + GanttTableItemsComponent, ], providers: [], }) diff --git a/packages/gantt/src/table/column/column.component.html b/packages/gantt/src/table/column/column.component.html new file mode 100644 index 00000000..6dbc7430 --- /dev/null +++ b/packages/gantt/src/table/column/column.component.html @@ -0,0 +1 @@ + diff --git a/packages/gantt/src/table/column/column.component.ts b/packages/gantt/src/table/column/column.component.ts index b178693e..13ff5aa5 100644 --- a/packages/gantt/src/table/column/column.component.ts +++ b/packages/gantt/src/table/column/column.component.ts @@ -1,10 +1,14 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ContentChild, TemplateRef, Input } from '@angular/core'; @Component({ - selector: 'gantt-table-column', - template: '', + selector: 'ngx-gantt-column', + templateUrl: './column.component.html', }) export class GanttTableColumnComponent implements OnInit { + @Input() name: string; + + @ContentChild('cell', { static: true }) templateRef: TemplateRef; + constructor() {} ngOnInit() {} diff --git a/packages/gantt/src/table/gantt-table.component.html b/packages/gantt/src/table/gantt-table.component.html index 3a7aabfd..db6e8fb6 100644 --- a/packages/gantt/src/table/gantt-table.component.html +++ b/packages/gantt/src/table/gantt-table.component.html @@ -1,9 +1,33 @@ - + +
+ + + + +
+ {{ column.name }} +
+
+
+ + + + + + +
+
-
+
diff --git a/packages/gantt/src/table/gantt-table.component.ts b/packages/gantt/src/table/gantt-table.component.ts index a79a74a8..c45fef8a 100644 --- a/packages/gantt/src/table/gantt-table.component.ts +++ b/packages/gantt/src/table/gantt-table.component.ts @@ -1,16 +1,8 @@ -import { - Component, - OnInit, - ElementRef, - ChangeDetectionStrategy, - Input, - EventEmitter, - Output, - HostBinding, -} from '@angular/core'; +import { Component, OnInit, ElementRef, ChangeDetectionStrategy, Input, EventEmitter, Output } from '@angular/core'; import { GanttUpper } from '../gantt-upper'; import { GanttRef, GANTT_REF_TOKEN } from '../gantt-ref'; import { GanttDependencyDragEvent, GanttDependencyEvent, GanttItemInternal } from '../class'; + @Component({ selector: 'ngx-gantt', templateUrl: './gantt-table.component.html', diff --git a/packages/gantt/src/table/group/group.component.html b/packages/gantt/src/table/group/group.component.html index e69de29b..59efce8e 100644 --- a/packages/gantt/src/table/group/group.component.html +++ b/packages/gantt/src/table/group/group.component.html @@ -0,0 +1,7 @@ +
+ +
+ diff --git a/packages/gantt/src/table/group/group.component.ts b/packages/gantt/src/table/group/group.component.ts index e69de29b..5cfd9136 100644 --- a/packages/gantt/src/table/group/group.component.ts +++ b/packages/gantt/src/table/group/group.component.ts @@ -0,0 +1,18 @@ +import { Component, OnInit, TemplateRef, Input, ViewChild, ElementRef, HostBinding } from '@angular/core'; +import { GanttGroup } from '../../class/group'; + +@Component({ + selector: 'gantt-table-group', + templateUrl: './group.component.html', +}) +export class GanttTableGroupComponent implements OnInit { + @Input() group: GanttGroup; + + @Input() groupHeader: TemplateRef; + + @HostBinding('class.gantt-table-group') ganttTableGroupClass = true; + + constructor(public elementRef: ElementRef) {} + + ngOnInit() {} +} diff --git a/packages/gantt/src/table/items/items.component.html b/packages/gantt/src/table/items/items.component.html index e69de29b..3867a58e 100644 --- a/packages/gantt/src/table/items/items.component.html +++ b/packages/gantt/src/table/items/items.component.html @@ -0,0 +1,34 @@ + + + + + + +
+ + + + +
+ +
+ + +
+ + + + diff --git a/packages/gantt/src/table/items/items.component.ts b/packages/gantt/src/table/items/items.component.ts index e69de29b..6ed250f1 100644 --- a/packages/gantt/src/table/items/items.component.ts +++ b/packages/gantt/src/table/items/items.component.ts @@ -0,0 +1,19 @@ +import { Component, OnInit, Input, HostBinding, QueryList } from '@angular/core'; +import { GanttItem } from '../../class/item'; +import { GanttTableColumnComponent } from '../column/column.component'; + +@Component({ + selector: 'gantt-table-items', + templateUrl: './items.component.html', +}) +export class GanttTableItemsComponent implements OnInit { + @Input() items: GanttItem[] = []; + + @Input() columns: QueryList; + + @HostBinding('class.gantt-table-items') ganttTableItemsClass = true; + + constructor() {} + + ngOnInit() {} +}