diff --git a/example/src/app/gantt/gantt.component.html b/example/src/app/gantt/gantt.component.html index 876ea075..c7211891 100644 --- a/example/src/app/gantt/gantt.component.html +++ b/example/src/app/gantt/gantt.component.html @@ -45,17 +45,17 @@ (linkDragEnded)="linkDragEnded($event)" > - - {{ item.title }} - - {{ item.start * 1000 | date: 'yyyy-MM-dd' }} + {{ item.start * 1000 | date : 'yyyy-MM-dd' }} + + {{ item.title }} + - {{ item.end * 1000 | date: 'yyyy-MM-dd' }} + {{ item.end * 1000 | date : 'yyyy-MM-dd' }} diff --git a/packages/gantt/src/components/table/gantt-table.component.html b/packages/gantt/src/components/table/gantt-table.component.html index 2c123e59..37e08dc2 100644 --- a/packages/gantt/src/components/table/gantt-table.component.html +++ b/packages/gantt/src/components/table/gantt-table.component.html @@ -83,7 +83,7 @@ [ngTemplateOutletContext]="{ $implicit: item.origin, item: item.origin }" >
-
+
) { + this.hasFixedExpandIcon = false; columns.forEach((column) => { if (!column.columnWidth) { column.columnWidth = coerceCssPixelValue(defaultColumnWidth); } + if (column.fixedExpandIcon) { + this.hasFixedExpandIcon = true; + } }); this.columnList = columns; } diff --git a/packages/gantt/src/components/table/test/table.spec.ts b/packages/gantt/src/components/table/test/table.spec.ts index 1a1523ac..d0d5ed41 100644 --- a/packages/gantt/src/components/table/test/table.spec.ts +++ b/packages/gantt/src/components/table/test/table.spec.ts @@ -11,7 +11,12 @@ import { GanttMainComponent } from 'ngx-gantt/components/main/gantt-main.compone template: ` - + + + {{ item.start * 1000 | date : 'yyyy-MM-dd' }} + + + {{ item.title }} @@ -34,6 +39,8 @@ export class TestGanttTableComponent { multiple = true; + fixedExpandIcon = true; + constructor() {} } @@ -202,4 +209,10 @@ describe('GanttTable', () => { itemNode.click(); expect(selectionModel.selected.length).toEqual(0); }); + + it('should fixed expand icon column', () => { + const ganttTable: DebugElement = fixture.debugElement.query(By.directive(GanttTableComponent)); + const column = ganttTable.queryAll(By.css('.gantt-table-item'))[0].queryAll(By.css('.gantt-table-column'))[1]; + expect(column.nativeElement.querySelector('.gantt-expand-icon').classList.contains('gantt-expand-icon')).toBeTrue(); + }); }); diff --git a/packages/gantt/src/table/gantt-column.component.ts b/packages/gantt/src/table/gantt-column.component.ts index 39d8dbd6..bc72b037 100644 --- a/packages/gantt/src/table/gantt-column.component.ts +++ b/packages/gantt/src/table/gantt-column.component.ts @@ -15,6 +15,8 @@ export class NgxGanttTableColumnComponent { @Input() name: string; + @Input() fixedExpandIcon: boolean; + @ContentChild('cell', { static: true }) templateRef: TemplateRef; @ContentChild('header', { static: true }) headerTemplateRef: TemplateRef; diff --git a/packages/gantt/src/test/mocks/data.ts b/packages/gantt/src/test/mocks/data.ts index 33e65d7a..21c92029 100644 --- a/packages/gantt/src/test/mocks/data.ts +++ b/packages/gantt/src/test/mocks/data.ts @@ -165,9 +165,19 @@ export function getMockGroupItems() { id: 'item-child-0101', title: 'VERSION Children 0101', start: new GanttDate('2020-05-21 12:34:35').getUnixTime(), - group_id: '00001', + group_id: 'item-0101', color: '#FF0000', - linkable: false + linkable: false, + children: [ + { + id: 'item-child-010101', + title: 'VERSION Children 010101', + start: new GanttDate('2020-05-21 12:34:35').getUnixTime(), + group_id: 'item-child-0101', + color: '#FF0000', + linkable: false + } + ] } ] },