Skip to content

Commit 94f7e60

Browse files
committed
feat(arc-lib): updating gantt module
updating gantt module GH-58
1 parent e36bfe1 commit 94f7e60

33 files changed

+270
-522
lines changed

projects/arc-lib/src/lib/components/gantt/components/bb-gantt.component.html

Lines changed: 0 additions & 14 deletions
This file was deleted.

projects/arc-lib/src/lib/components/gantt/components/bb-gantt.component.scss

Lines changed: 0 additions & 15 deletions
This file was deleted.

projects/arc-lib/src/lib/components/gantt/components/bb-gantt.component.ts

Lines changed: 0 additions & 157 deletions
This file was deleted.

projects/arc-lib/src/lib/components/gantt/components/gantt-bars/gantt-bars-routing.module.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

projects/arc-lib/src/lib/components/gantt/components/gantt-bars/gantt-bars.component.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@
3838
[attr.gantt-bar-data]="stringify(allocationBar)"
3939
gantt-hover="bar"
4040
[ngClass]="allocationBar.classes ?? []"
41-
[ngStyle]="{
42-
width: allocationBar.percent + '%',
43-
}"
41+
[ngStyle]="{width: allocationBar.percent + '%'}"
4442
[class.empty]="!allocationBar.allocation"
4543
[class.over-allocated]="allocationBar.allocation > allocationBase"
4644
>

projects/arc-lib/src/lib/components/gantt/components/gantt-bars/gantt-bars.component.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@use 'sass:map';
2-
// @use "../../../../theme/styles/variables" as *;
3-
@use 'projects/arc-lib/src/lib/theme/styles/_variables.scss' as *;
2+
@use '../../../../theme/styles/variables' as *;
43

54
.actual-rate {
65
padding: 0.25rem 0.5rem;
@@ -28,7 +27,7 @@
2827
display: flex;
2928
justify-content: space-between;
3029
align-items: center;
31-
height: 100%;
30+
height: 20px;
3231
overflow: hidden;
3332

3433
&.actual-bar {

projects/arc-lib/src/lib/components/gantt/components/gantt-bars/gantt-bars.component.spec.ts

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,16 @@
11
import {ComponentFixture, TestBed} from '@angular/core/testing';
2-
import {AnyObject} from '@project-lib/core/api';
3-
import {TranslationService} from '@project-lib/core/localization';
4-
import {
5-
TranslateFakeLoader,
6-
TranslateLoader,
7-
TranslateModule,
8-
TranslateService,
9-
} from '@ngx-translate/core';
2+
103
import {GanttBarsComponent} from './gantt-bars.component';
114

125
describe('GanttBarsComponent', () => {
13-
let component: GanttBarsComponent<AnyObject>;
14-
let fixture: ComponentFixture<GanttBarsComponent<AnyObject>>;
6+
let component: GanttBarsComponent;
7+
let fixture: ComponentFixture<GanttBarsComponent>;
158

169
beforeEach(async () => {
1710
await TestBed.configureTestingModule({
1811
declarations: [GanttBarsComponent],
19-
providers: [TranslateService, TranslationService],
20-
imports: [
21-
TranslateModule.forRoot({
22-
loader: {
23-
provide: TranslateLoader,
24-
useClass: TranslateFakeLoader,
25-
},
26-
}),
27-
],
2812
}).compileComponents();
29-
});
3013

31-
beforeEach(() => {
3214
fixture = TestBed.createComponent(GanttBarsComponent);
3315
component = fixture.componentInstance;
3416
fixture.detectChanges();
Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,32 @@
1-
import {Component} from '@angular/core';
2-
import {AnyObject} from '@project-lib/core/api';
3-
import {MAX_ALLOCATION} from '@project-lib/core/constants';
4-
import {TranslationService} from '@project-lib/core/localization';
5-
import {TranslateService} from '@ngx-translate/core';
6-
import {
7-
GanttTaskValue,
8-
GanttTaskValueWithSubAllocation,
9-
SubAllocation,
10-
} from '../../types';
1+
import {Component, Input} from '@angular/core';
2+
import {AllocationBar, Item} from '../../model/item.model';
113

124
@Component({
13-
selector: 'gantt-bars',
5+
selector: 'arc-gantt-bars',
146
templateUrl: './gantt-bars.component.html',
157
styleUrls: ['./gantt-bars.component.scss'],
168
})
17-
export class GanttBarsComponent<T extends AnyObject> {
18-
item!: GanttTaskValue<T>;
19-
allocationTypes: AnyObject;
20-
allocationBase = MAX_ALLOCATION;
21-
private translate: TranslateService;
22-
constructor(private translateSvc: TranslationService) {
23-
this.translate = translateSvc.translate;
24-
}
9+
export class GanttBarsComponent {
10+
@Input() item: Item;
11+
@Input() allocationTypes: any;
12+
@Input() allocationBase: number;
2513

26-
stringify(subAllocation: SubAllocation) {
27-
return JSON.stringify(subAllocation);
14+
constructor() {
15+
console.log('hii tiny');
16+
}
17+
formatAllocation(value: number): string {
18+
return `${value} hours`;
2819
}
29-
formatter(rate: number) {
30-
return `$${rate}/${this.translate.instant('hr')}`;
20+
21+
formatter(value: number): string {
22+
return `$${value}/hour`;
3123
}
3224

33-
formatAllocation(allocation: number) {
34-
return `${allocation}${this.translate.instant('h/d')}`;
25+
hasSubAllocation(item: Item): boolean {
26+
return item.subAllocations && item.subAllocations.length > 0;
3527
}
3628

37-
hasSubAllocation(
38-
item: GanttTaskValue<T>,
39-
): item is GanttTaskValueWithSubAllocation<T> {
40-
return !!(item as GanttTaskValueWithSubAllocation<T>).subAllocations;
29+
stringify(allocationBar: AllocationBar): string {
30+
return JSON.stringify(allocationBar);
4131
}
4232
}

projects/arc-lib/src/lib/components/gantt/components/gantt-bars/gantt-bars.module.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

projects/arc-lib/src/lib/components/gantt/components/gantt-column/gantt-column-routing.module.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)