@worktile/gantt 12.0.1 → 12.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -116
- package/bundles/worktile-gantt.umd.js +3303 -0
- package/bundles/worktile-gantt.umd.js.map +1 -0
- package/class/date-point.d.ts +15 -0
- package/{packages/gantt/src/class/event.ts → class/event.d.ts} +6 -12
- package/class/group.d.ts +22 -0
- package/{packages/gantt/src/class/index.ts → class/index.d.ts} +0 -0
- package/class/item.d.ts +70 -0
- package/class/view-type.d.ts +7 -0
- package/components/bar/bar-drag.d.ts +37 -0
- package/components/bar/bar.component.d.ts +26 -0
- package/components/calendar/calendar.component.d.ts +28 -0
- package/components/drag-backdrop/drag-backdrop.component.d.ts +9 -0
- package/components/icon/icon.component.d.ts +13 -0
- package/components/icon/icons.d.ts +8 -0
- package/components/links/links.component.d.ts +47 -0
- package/components/main/gantt-main.component.d.ts +21 -0
- package/components/range/range.component.d.ts +13 -0
- package/components/table/gantt-table.component.d.ts +36 -0
- package/esm2015/class/date-point.js +10 -0
- package/esm2015/class/event.js +13 -0
- package/esm2015/class/group.js +17 -0
- package/esm2015/class/index.js +6 -0
- package/esm2015/class/item.js +78 -0
- package/esm2015/class/view-type.js +9 -0
- package/esm2015/components/bar/bar-drag.js +264 -0
- package/esm2015/components/bar/bar.component.js +98 -0
- package/esm2015/components/calendar/calendar.component.js +86 -0
- package/esm2015/components/drag-backdrop/drag-backdrop.component.js +21 -0
- package/esm2015/components/icon/icon.component.js +38 -0
- package/esm2015/components/icon/icons.js +87 -0
- package/esm2015/components/links/links.component.js +213 -0
- package/esm2015/components/main/gantt-main.component.js +53 -0
- package/esm2015/components/range/range.component.js +37 -0
- package/esm2015/components/table/gantt-table.component.js +146 -0
- package/esm2015/gantt-abstract.js +3 -0
- package/esm2015/gantt-dom.service.js +103 -0
- package/esm2015/gantt-drag-container.js +59 -0
- package/esm2015/gantt-item-upper.js +58 -0
- package/esm2015/gantt-print.service.js +94 -0
- package/esm2015/gantt-upper.js +254 -0
- package/esm2015/gantt.component.js +131 -0
- package/esm2015/gantt.module.js +74 -0
- package/esm2015/gantt.pipe.js +43 -0
- package/esm2015/gantt.styles.js +15 -0
- package/esm2015/public-api.js +18 -0
- package/esm2015/root.component.js +123 -0
- package/esm2015/table/gantt-column.component.js +37 -0
- package/esm2015/table/gantt-table.component.js +20 -0
- package/esm2015/utils/date.js +160 -0
- package/esm2015/utils/helpers.js +55 -0
- package/esm2015/views/day.js +54 -0
- package/esm2015/views/factory.js +23 -0
- package/esm2015/views/month.js +48 -0
- package/esm2015/views/quarter.js +51 -0
- package/esm2015/views/view.js +121 -0
- package/esm2015/views/week.js +49 -0
- package/esm2015/views/year.js +50 -0
- package/esm2015/worktile-gantt.js +5 -0
- package/fesm2015/worktile-gantt.js +2637 -0
- package/fesm2015/worktile-gantt.js.map +1 -0
- package/{packages/gantt/src/gantt-abstract.ts → gantt-abstract.d.ts} +1 -3
- package/gantt-dom.service.d.ts +32 -0
- package/gantt-drag-container.d.ts +23 -0
- package/gantt-item-upper.d.ts +20 -0
- package/gantt-print.service.d.ts +13 -0
- package/gantt-upper.d.ts +64 -0
- package/gantt.component.d.ts +29 -0
- package/gantt.module.d.ts +21 -0
- package/gantt.pipe.d.ts +18 -0
- package/gantt.styles.d.ts +15 -0
- package/main.bundle.scss +645 -0
- package/package.json +16 -113
- package/{packages/gantt/src/public-api.ts → public-api.d.ts} +0 -4
- package/root.component.d.ts +28 -0
- package/table/gantt-column.component.d.ts +15 -0
- package/table/gantt-table.component.d.ts +10 -0
- package/utils/date.d.ts +59 -0
- package/utils/helpers.d.ts +12 -0
- package/views/day.d.ts +14 -0
- package/views/factory.d.ts +8 -0
- package/views/month.d.ts +12 -0
- package/views/quarter.d.ts +12 -0
- package/views/view.d.ts +56 -0
- package/views/week.d.ts +12 -0
- package/views/year.d.ts +12 -0
- package/worktile-gantt.d.ts +5 -0
- package/.all-contributorsrc +0 -53
- package/.angulardoc.json +0 -4
- package/.circleci/config.yml +0 -17
- package/.coveralls.yml +0 -1
- package/.docgenirc.js +0 -64
- package/.editorconfig +0 -22
- package/.prettierrc +0 -24
- package/.travis.yml +0 -23
- package/CHANGELOG.md +0 -564
- package/Dockerfile +0 -4
- package/LICENSE +0 -21
- package/angular.json +0 -136
- package/docs/guides/basic/components.md +0 -54
- package/docs/guides/basic/event.md +0 -70
- package/docs/guides/basic/index.md +0 -4
- package/docs/guides/basic/style.md +0 -68
- package/docs/guides/basic/type.md +0 -70
- package/docs/guides/basic/usage.md +0 -189
- package/docs/guides/index.md +0 -5
- package/docs/guides/intro/getting-started.md +0 -79
- package/docs/guides/intro/index.md +0 -51
- package/docs/index.md +0 -0
- package/example/browserslist +0 -12
- package/example/src/app/app-routing.module.ts +0 -26
- package/example/src/app/app.component.html +0 -2
- package/example/src/app/app.component.ts +0 -11
- package/example/src/app/app.module.ts +0 -57
- package/example/src/app/components/components.component.html +0 -6
- package/example/src/app/components/components.component.ts +0 -33
- package/example/src/app/configuration/parameters/api/zh-cn.js +0 -350
- package/example/src/app/configuration/parameters/doc/zh-cn.md +0 -5
- package/example/src/app/gantt/gantt.component.html +0 -51
- package/example/src/app/gantt/gantt.component.ts +0 -119
- package/example/src/app/gantt-advanced/component/flat.component.html +0 -30
- package/example/src/app/gantt-advanced/component/flat.component.ts +0 -72
- package/example/src/app/gantt-advanced/component/flat.scss +0 -31
- package/example/src/app/gantt-advanced/gantt-advanced.component.html +0 -32
- package/example/src/app/gantt-advanced/gantt-advanced.component.ts +0 -34
- package/example/src/app/gantt-advanced/mocks.ts +0 -158
- package/example/src/app/gantt-groups/gantt-groups.component.html +0 -42
- package/example/src/app/gantt-groups/gantt-groups.component.ts +0 -62
- package/example/src/app/gantt-range/gantt-range.component.html +0 -66
- package/example/src/app/gantt-range/gantt-range.component.ts +0 -67
- package/example/src/app/gantt-range/mocks.ts +0 -150
- package/example/src/app/helper.ts +0 -38
- package/example/src/assets/.gitkeep +0 -0
- package/example/src/environments/environment.prod.ts +0 -3
- package/example/src/environments/environment.ts +0 -16
- package/example/src/favicon.ico +0 -0
- package/example/src/index.html +0 -13
- package/example/src/main.ts +0 -12
- package/example/src/polyfills.ts +0 -63
- package/example/src/styles.scss +0 -56
- package/example/tsconfig.app.json +0 -18
- package/nginx.conf +0 -17
- package/packages/gantt/README.md +0 -24
- package/packages/gantt/karma.conf.js +0 -46
- package/packages/gantt/ng-package.json +0 -7
- package/packages/gantt/ng-package.prod.json +0 -7
- package/packages/gantt/package.json +0 -16
- package/packages/gantt/src/class/date-point.ts +0 -14
- package/packages/gantt/src/class/group.ts +0 -36
- package/packages/gantt/src/class/item.ts +0 -129
- package/packages/gantt/src/class/test/group.spec.ts +0 -21
- package/packages/gantt/src/class/test/item.spec.ts +0 -102
- package/packages/gantt/src/class/view-type.ts +0 -7
- package/packages/gantt/src/components/bar/bar-drag.ts +0 -298
- package/packages/gantt/src/components/bar/bar.component.html +0 -17
- package/packages/gantt/src/components/bar/bar.component.scss +0 -169
- package/packages/gantt/src/components/bar/bar.component.ts +0 -109
- package/packages/gantt/src/components/bar/test/bar.component.spec.ts +0 -54
- package/packages/gantt/src/components/bar/test/bar.drag.spec.ts +0 -196
- package/packages/gantt/src/components/calendar/calendar.component.html +0 -52
- package/packages/gantt/src/components/calendar/calendar.component.scss +0 -77
- package/packages/gantt/src/components/calendar/calendar.component.ts +0 -100
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.html +0 -6
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.scss +0 -48
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.ts +0 -13
- package/packages/gantt/src/components/icon/icon.component.scss +0 -13
- package/packages/gantt/src/components/icon/icon.component.ts +0 -28
- package/packages/gantt/src/components/icon/icons.ts +0 -86
- package/packages/gantt/src/components/links/links.component.html +0 -19
- package/packages/gantt/src/components/links/links.component.scss +0 -27
- package/packages/gantt/src/components/links/links.component.ts +0 -263
- package/packages/gantt/src/components/main/gantt-main.component.html +0 -35
- package/packages/gantt/src/components/main/gantt-main.component.ts +0 -35
- package/packages/gantt/src/components/range/range.component.html +0 -8
- package/packages/gantt/src/components/range/range.component.scss +0 -35
- package/packages/gantt/src/components/range/range.component.ts +0 -27
- package/packages/gantt/src/components/range/test/range.component.spec.ts +0 -80
- package/packages/gantt/src/components/table/gantt-table.component.html +0 -105
- package/packages/gantt/src/components/table/gantt-table.component.scss +0 -144
- package/packages/gantt/src/components/table/gantt-table.component.ts +0 -166
- package/packages/gantt/src/components/table/test/table.spec.ts +0 -129
- package/packages/gantt/src/gantt-dom.service.ts +0 -134
- package/packages/gantt/src/gantt-drag-container.ts +0 -73
- package/packages/gantt/src/gantt-item-upper.ts +0 -50
- package/packages/gantt/src/gantt-print.service.ts +0 -104
- package/packages/gantt/src/gantt-upper.ts +0 -289
- package/packages/gantt/src/gantt.component.html +0 -18
- package/packages/gantt/src/gantt.component.scss +0 -77
- package/packages/gantt/src/gantt.component.ts +0 -134
- package/packages/gantt/src/gantt.module.ts +0 -47
- package/packages/gantt/src/gantt.pipe.ts +0 -31
- package/packages/gantt/src/gantt.styles.ts +0 -28
- package/packages/gantt/src/root.component.html +0 -12
- package/packages/gantt/src/root.component.ts +0 -121
- package/packages/gantt/src/styles/index.scss +0 -9
- package/packages/gantt/src/styles/variables.scss +0 -46
- package/packages/gantt/src/table/gantt-column.component.ts +0 -25
- package/packages/gantt/src/table/gantt-table.component.ts +0 -14
- package/packages/gantt/src/table/test/table.spec.ts +0 -56
- package/packages/gantt/src/test/gantt.component.spec.ts +0 -404
- package/packages/gantt/src/test/mocks/data.ts +0 -303
- package/packages/gantt/src/test.ts +0 -21
- package/packages/gantt/src/utils/date.ts +0 -276
- package/packages/gantt/src/utils/helpers.ts +0 -66
- package/packages/gantt/src/utils/test/date.spec.ts +0 -105
- package/packages/gantt/src/utils/test/helpers.spec.ts +0 -73
- package/packages/gantt/src/utils/testing.ts +0 -64
- package/packages/gantt/src/views/day.ts +0 -74
- package/packages/gantt/src/views/factory.ts +0 -25
- package/packages/gantt/src/views/month.ts +0 -66
- package/packages/gantt/src/views/quarter.ts +0 -68
- package/packages/gantt/src/views/test/day.spec.ts +0 -45
- package/packages/gantt/src/views/test/factory.spec.ts +0 -41
- package/packages/gantt/src/views/test/mock.ts +0 -14
- package/packages/gantt/src/views/test/month.spec.ts +0 -45
- package/packages/gantt/src/views/test/quarter.spec.ts +0 -45
- package/packages/gantt/src/views/test/view.spec.ts +0 -144
- package/packages/gantt/src/views/test/week.spec.ts +0 -45
- package/packages/gantt/src/views/test/year.spec.ts +0 -45
- package/packages/gantt/src/views/view.ts +0 -186
- package/packages/gantt/src/views/week.ts +0 -66
- package/packages/gantt/src/views/year.ts +0 -62
- package/packages/gantt/tsconfig.lib.json +0 -20
- package/packages/gantt/tsconfig.lib.prod.json +0 -9
- package/packages/gantt/tsconfig.schematics.json +0 -25
- package/packages/gantt/tsconfig.spec.json +0 -17
- package/packages/gantt/tslint.json +0 -18
- package/scss-bundle.config.json +0 -7
- package/tsconfig.json +0 -26
- package/tslint.json +0 -51
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Component,
|
|
3
|
-
OnInit,
|
|
4
|
-
HostBinding,
|
|
5
|
-
OnChanges,
|
|
6
|
-
SimpleChanges,
|
|
7
|
-
OnDestroy,
|
|
8
|
-
NgZone,
|
|
9
|
-
Inject,
|
|
10
|
-
ElementRef,
|
|
11
|
-
AfterViewInit
|
|
12
|
-
} from '@angular/core';
|
|
13
|
-
import { GanttDatePoint } from '../../class/date-point';
|
|
14
|
-
import { Subject, merge } from 'rxjs';
|
|
15
|
-
import { take, takeUntil } from 'rxjs/operators';
|
|
16
|
-
import { headerHeight, todayHeight, todayWidth, todayBorderRadius } from '../../gantt.styles';
|
|
17
|
-
import { isNumber } from '../../utils/helpers';
|
|
18
|
-
import { GanttDate } from '../../utils/date';
|
|
19
|
-
import { GANTT_UPPER_TOKEN, GanttUpper } from '../../gantt-upper';
|
|
20
|
-
import { GanttViewType } from './../../class/view-type';
|
|
21
|
-
|
|
22
|
-
const mainHeight = 5000;
|
|
23
|
-
|
|
24
|
-
@Component({
|
|
25
|
-
selector: 'gantt-calendar-overlay',
|
|
26
|
-
templateUrl: './calendar.component.html'
|
|
27
|
-
})
|
|
28
|
-
export class GanttCalendarComponent implements OnInit, AfterViewInit, OnChanges, OnDestroy {
|
|
29
|
-
get view() {
|
|
30
|
-
return this.ganttUpper.view;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
private unsubscribe$ = new Subject();
|
|
34
|
-
|
|
35
|
-
headerHeight = headerHeight;
|
|
36
|
-
|
|
37
|
-
mainHeight = mainHeight;
|
|
38
|
-
|
|
39
|
-
todayHeight = todayHeight;
|
|
40
|
-
|
|
41
|
-
todayWidth = todayWidth;
|
|
42
|
-
|
|
43
|
-
todayBorderRadius = todayBorderRadius;
|
|
44
|
-
|
|
45
|
-
viewTypes = GanttViewType;
|
|
46
|
-
|
|
47
|
-
@HostBinding('class.gantt-calendar-overlay') className = true;
|
|
48
|
-
|
|
49
|
-
constructor(
|
|
50
|
-
@Inject(GANTT_UPPER_TOKEN) public ganttUpper: GanttUpper,
|
|
51
|
-
private ngZone: NgZone,
|
|
52
|
-
private elementRef: ElementRef<HTMLElement>
|
|
53
|
-
) {}
|
|
54
|
-
|
|
55
|
-
setTodayPoint() {
|
|
56
|
-
const x = this.view.getTodayXPoint();
|
|
57
|
-
const today = new GanttDate().getDate();
|
|
58
|
-
const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0] as HTMLElement;
|
|
59
|
-
const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0] as HTMLElement;
|
|
60
|
-
const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0] as HTMLElement;
|
|
61
|
-
|
|
62
|
-
if (isNumber(x)) {
|
|
63
|
-
if (rect) {
|
|
64
|
-
rect.style.left = `${x - todayWidth / 2}px`;
|
|
65
|
-
rect.style.top = `${headerHeight - todayHeight}px`;
|
|
66
|
-
rect.innerHTML = today.toString();
|
|
67
|
-
}
|
|
68
|
-
if (line) {
|
|
69
|
-
line.style.left = `${x}px`;
|
|
70
|
-
line.style.top = `${headerHeight}px`;
|
|
71
|
-
line.style.bottom = `${-mainHeight}px`;
|
|
72
|
-
}
|
|
73
|
-
} else {
|
|
74
|
-
todayEle.style.display = 'none';
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
ngOnInit() {
|
|
79
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
80
|
-
merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
|
|
81
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
82
|
-
.subscribe(() => {
|
|
83
|
-
this.setTodayPoint();
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
ngAfterViewInit() {}
|
|
89
|
-
|
|
90
|
-
ngOnChanges(changes: SimpleChanges): void {}
|
|
91
|
-
|
|
92
|
-
trackBy(point: GanttDatePoint, index: number) {
|
|
93
|
-
return point.text || index;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
ngOnDestroy() {
|
|
97
|
-
this.unsubscribe$.next();
|
|
98
|
-
this.unsubscribe$.complete();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
.gantt-drag-backdrop {
|
|
2
|
-
position: absolute;
|
|
3
|
-
top: 0;
|
|
4
|
-
right: 0;
|
|
5
|
-
bottom: 0;
|
|
6
|
-
left: 0;
|
|
7
|
-
z-index: 2;
|
|
8
|
-
display: none;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.gantt-drag-mask {
|
|
12
|
-
position: absolute;
|
|
13
|
-
top: $gantt-header-height;
|
|
14
|
-
z-index: 1;
|
|
15
|
-
height: 100%;
|
|
16
|
-
display: none;
|
|
17
|
-
background: rgba($color: $gantt-item-drag-mask-color, $alpha: 0.05);
|
|
18
|
-
|
|
19
|
-
.date-range {
|
|
20
|
-
width: 100%;
|
|
21
|
-
min-width: 120px;
|
|
22
|
-
top: -23px;
|
|
23
|
-
background: $gantt-item-drag-mask-color;
|
|
24
|
-
line-height: 23px;
|
|
25
|
-
border-radius: 4px;
|
|
26
|
-
color: #fff;
|
|
27
|
-
position: absolute;
|
|
28
|
-
display: flex;
|
|
29
|
-
justify-content: space-between;
|
|
30
|
-
padding: 0 10px;
|
|
31
|
-
box-sizing: border-box
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.gantt-link-drag-container {
|
|
36
|
-
width: 100%;
|
|
37
|
-
height: 1px;
|
|
38
|
-
overflow: visible !important;
|
|
39
|
-
position: absolute;
|
|
40
|
-
top: 0;
|
|
41
|
-
left: 0;
|
|
42
|
-
z-index: 2000;
|
|
43
|
-
|
|
44
|
-
.link-dragging-line {
|
|
45
|
-
stroke: $gantt-link-dragging-line-color;
|
|
46
|
-
stroke-width: 2px;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, HostBinding } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'gantt-drag-backdrop',
|
|
5
|
-
templateUrl: `./drag-backdrop.component.html`
|
|
6
|
-
})
|
|
7
|
-
export class GanttDragBackdropComponent implements OnInit {
|
|
8
|
-
@HostBinding('class.gantt-drag-backdrop') backdropClass = true;
|
|
9
|
-
|
|
10
|
-
constructor() {}
|
|
11
|
-
|
|
12
|
-
ngOnInit() {}
|
|
13
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, Input, AfterViewInit, ElementRef, HostBinding } from '@angular/core';
|
|
2
|
-
import { icons } from './icons';
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'gantt-icon',
|
|
5
|
-
template: ''
|
|
6
|
-
})
|
|
7
|
-
export class GanttIconComponent implements OnInit, AfterViewInit {
|
|
8
|
-
@HostBinding('class.gantt-icon') isIcon = true;
|
|
9
|
-
|
|
10
|
-
@Input() set iconName(name: string) {
|
|
11
|
-
this.setSvg(name);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
constructor(private elementRef: ElementRef<HTMLElement>) {}
|
|
15
|
-
|
|
16
|
-
ngOnInit(): void {}
|
|
17
|
-
|
|
18
|
-
ngAfterViewInit() {}
|
|
19
|
-
|
|
20
|
-
setSvg(name: string) {
|
|
21
|
-
const iconSvg = icons[name];
|
|
22
|
-
if (iconSvg) {
|
|
23
|
-
this.elementRef.nativeElement.innerHTML = iconSvg;
|
|
24
|
-
} else {
|
|
25
|
-
this.elementRef.nativeElement.innerHTML = '';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
const angleRight = `<svg xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="amnavigation/angle-right" stroke-width="1" fill-rule="evenodd"><path d="M7.978 11.498l-.005.005L2.3 5.831 3.13 5l4.848 4.848L12.826 5l.83.831-5.673 5.672-.005-.005z" transform="rotate(-90 7.978 8.252)"></path></g></svg>`;
|
|
2
|
-
const angleDown = `<svg xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="aknavigation/angle-down" stroke-width="1" fill-rule="evenodd"><path d="M7.978 11.997l-.005.006L2.3 6.33l.83-.831 4.848 4.848L12.826 5.5l.83.83-5.673 5.673-.005-.006z" ></path></g></svg>`;
|
|
3
|
-
const plusSquare = `<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="kxaction/plus-square" stroke-width="1" fill-rule="evenodd"><path d="M2 0h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2zm0 1.2a.8.8 0 0 0-.8.8v12a.8.8 0 0 0 .8.8h12a.8.8 0 0 0 .8-.8V2a.8.8 0 0 0-.8-.8H2zm5.45 6.2V4.75h1.2V7.4h2.65v1.2H8.65v2.65h-1.2V8.6H4.8V7.4h2.65z"></path></g></svg>`;
|
|
4
|
-
const minusSquare = `<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="jnaction/minus-square" stroke-width="1" fill-rule="evenodd"><path d="M2 0h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2zm0 1.2a.8.8 0 0 0-.8.8v12a.8.8 0 0 0 .8.8h12a.8.8 0 0 0 .8-.8V2a.8.8 0 0 0-.8-.8H2zm2.8 6.2h6.5v1.2H4.8V7.4z"></path></g></svg>`;
|
|
5
|
-
const loadingIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50" xml:space="preserve">
|
|
6
|
-
<path fill="#aaa" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)">
|
|
7
|
-
<animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform>
|
|
8
|
-
</path>
|
|
9
|
-
</svg>`;
|
|
10
|
-
const emptyIcon = `<svg
|
|
11
|
-
width="148px"
|
|
12
|
-
height="134px"
|
|
13
|
-
viewBox="0 0 148 134"
|
|
14
|
-
version="1.1"
|
|
15
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
16
|
-
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
17
|
-
>
|
|
18
|
-
<defs>
|
|
19
|
-
<filter x="0.0%" y="0.0%" width="100.0%" height="100.0%" filterUnits="objectBoundingBox" id="filter-1">
|
|
20
|
-
<feGaussianBlur stdDeviation="0" in="SourceGraphic"></feGaussianBlur>
|
|
21
|
-
</filter>
|
|
22
|
-
</defs>
|
|
23
|
-
<g id="148x134" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
24
|
-
<g id="编组-6" transform="translate(1.000000, 1.000000)">
|
|
25
|
-
<ellipse
|
|
26
|
-
id="椭圆形"
|
|
27
|
-
fill="#EDEEF2"
|
|
28
|
-
opacity="0.3"
|
|
29
|
-
filter="url(#filter-1)"
|
|
30
|
-
cx="73.0800017"
|
|
31
|
-
cy="115.920003"
|
|
32
|
-
rx="73.0800017"
|
|
33
|
-
ry="16.8000004"
|
|
34
|
-
></ellipse>
|
|
35
|
-
<g id="编组-5" transform="translate(15.120000, 0.000000)">
|
|
36
|
-
<polygon
|
|
37
|
-
id="矩形"
|
|
38
|
-
fill="#E2E4E9"
|
|
39
|
-
points="19.2789848 49.5600011 99.1200023 48.7200011 117.600003 75.9297673 117.600003 92.313049 0 92.313049 0 75.0356267"
|
|
40
|
-
></polygon>
|
|
41
|
-
<path
|
|
42
|
-
d="M23.5200005,0 L94.0800002,0 C97.7913538,2.06413823e-16 100.8,3.00864655 100.8,6.72000015 L100.8,99.1200023 L100.8,99.1200023 L16.8000004,99.1200023 L16.8000004,6.72000015 C16.8000004,3.00864655 19.8086469,1.56994302e-15 23.5200005,0 Z"
|
|
43
|
-
id="矩形"
|
|
44
|
-
fill="#F9FAFB"
|
|
45
|
-
></path>
|
|
46
|
-
<path
|
|
47
|
-
d="M30.9200007,12.4400003 L86.6800019,12.4400003 C88.5356787,12.4400003 90.040002,13.9443236 90.040002,15.8000004 L90.040002,42.000001 C90.040002,43.8556778 88.5356787,45.360001 86.6800019,45.360001 L30.9200007,45.360001 C29.0643239,45.360001 27.5600006,43.8556778 27.5600006,42.000001 L27.5600006,15.8000004 C27.5600006,13.9443236 29.0643239,12.4400003 30.9200007,12.4400003 Z"
|
|
48
|
-
id="矩形"
|
|
49
|
-
fill="#E8EAEE"
|
|
50
|
-
></path>
|
|
51
|
-
<text
|
|
52
|
-
id="</null>"
|
|
53
|
-
font-family="PingFangSC-Medium, PingFang SC"
|
|
54
|
-
font-size="15.1200003"
|
|
55
|
-
font-weight="400"
|
|
56
|
-
fill="#BCBECD"
|
|
57
|
-
>
|
|
58
|
-
<tspan x="33.6000008" y="32.8000004"></null></tspan>
|
|
59
|
-
</text>
|
|
60
|
-
<rect id="矩形" fill="#E8EAEE" x="27.5600006" y="52.0800012" width="61.4800014" height="5.04000011" rx="2.52000006"></rect>
|
|
61
|
-
<rect
|
|
62
|
-
id="矩形备份"
|
|
63
|
-
fill="#E8EAEE"
|
|
64
|
-
x="27.5600006"
|
|
65
|
-
y="63.8400014"
|
|
66
|
-
width="61.4800014"
|
|
67
|
-
height="5.04000011"
|
|
68
|
-
rx="2.52000006"
|
|
69
|
-
></rect>
|
|
70
|
-
<path
|
|
71
|
-
d="M0,75.6000017 L29.280235,75.6000017 C32.0637502,75.6000017 34.3202352,77.8564866 34.3202352,80.6400018 L34.3202352,86.2591426 C34.3202352,89.0426578 36.5767201,91.2991427 39.3602353,91.2991427 L78.4136737,91.2991427 C81.1971889,91.2991427 83.4536738,89.0426578 83.4536738,86.2591426 L83.4536738,80.6400018 C83.4536738,77.8564866 85.7101587,75.6000017 88.4936739,75.6000017 L117.600003,75.6000017 L117.600003,75.6000017 L117.600003,110.880003 C117.600003,115.519195 113.839194,119.280003 109.200002,119.280003 L8.40000019,119.280003 C3.76080819,119.280003 -6.53729019e-15,115.519195 0,110.880003 L0,75.6000017 L0,75.6000017 Z"
|
|
72
|
-
id="矩形"
|
|
73
|
-
fill="#EDEFF2"
|
|
74
|
-
></path>
|
|
75
|
-
</g>
|
|
76
|
-
</g>
|
|
77
|
-
</g>
|
|
78
|
-
</svg>`;
|
|
79
|
-
export const icons = {
|
|
80
|
-
'angle-right': angleRight,
|
|
81
|
-
'angle-down': angleDown,
|
|
82
|
-
'plus-square': plusSquare,
|
|
83
|
-
'minus-square': minusSquare,
|
|
84
|
-
loading: loadingIcon,
|
|
85
|
-
empty: emptyIcon
|
|
86
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<svg [attr.width]="ganttUpper.view.width" class="gantt-links-overlay-main">
|
|
2
|
-
<ng-container *ngFor="let link of links; let i = index; trackBy: trackBy">
|
|
3
|
-
<path [attr.d]="link.path" fill="transparent" stroke-width="2" [attr.stroke]="link.color" pointer-events="none"></path>
|
|
4
|
-
<g>
|
|
5
|
-
<path
|
|
6
|
-
class="link-line"
|
|
7
|
-
(click)="onLineClick($event, link)"
|
|
8
|
-
(mouseenter)="mouseEnterPath(link)"
|
|
9
|
-
(mouseleave)="mouseLeavePath(link)"
|
|
10
|
-
[attr.d]="link.path"
|
|
11
|
-
stroke="transparent"
|
|
12
|
-
stroke-width="9"
|
|
13
|
-
fill="none"
|
|
14
|
-
cursor="pointer"
|
|
15
|
-
></path>
|
|
16
|
-
</g>
|
|
17
|
-
</ng-container>
|
|
18
|
-
<line class="link-dragging-line"></line>
|
|
19
|
-
</svg>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
.gantt-links-overlay {
|
|
2
|
-
position: absolute;
|
|
3
|
-
top: 0px;
|
|
4
|
-
left: 0px;
|
|
5
|
-
width: 100%;
|
|
6
|
-
height: 100%;
|
|
7
|
-
svg {
|
|
8
|
-
overflow: visible;
|
|
9
|
-
z-index: 2;
|
|
10
|
-
position: absolute;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.link-dragging-container {
|
|
15
|
-
width: 100%;
|
|
16
|
-
height: 1px;
|
|
17
|
-
overflow: visible !important;
|
|
18
|
-
position: absolute;
|
|
19
|
-
top: $gantt-header-height;
|
|
20
|
-
left: 0;
|
|
21
|
-
z-index: 2000;
|
|
22
|
-
|
|
23
|
-
.link-dragging-line {
|
|
24
|
-
stroke: $gantt-link-line-color;
|
|
25
|
-
stroke-width: 2px;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Component,
|
|
3
|
-
OnInit,
|
|
4
|
-
Input,
|
|
5
|
-
Output,
|
|
6
|
-
EventEmitter,
|
|
7
|
-
HostBinding,
|
|
8
|
-
Inject,
|
|
9
|
-
ChangeDetectorRef,
|
|
10
|
-
ElementRef,
|
|
11
|
-
OnDestroy,
|
|
12
|
-
OnChanges
|
|
13
|
-
} from '@angular/core';
|
|
14
|
-
import { merge, Subject } from 'rxjs';
|
|
15
|
-
import { takeUntil, skip } from 'rxjs/operators';
|
|
16
|
-
import { GanttGroupInternal } from '../../class/group';
|
|
17
|
-
import { GanttItemInternal, GanttItem } from './../../class/item';
|
|
18
|
-
import { GanttLineClickEvent } from '../../class/event';
|
|
19
|
-
import { GanttDragContainer } from '../../gantt-drag-container';
|
|
20
|
-
import { recursiveItems } from '../../utils/helpers';
|
|
21
|
-
import { GanttDate } from '../../utils/date';
|
|
22
|
-
import { GANTT_UPPER_TOKEN, GanttUpper } from '../../gantt-upper';
|
|
23
|
-
|
|
24
|
-
enum LinkColors {
|
|
25
|
-
default = '#cacaca',
|
|
26
|
-
blocked = '#FF7575',
|
|
27
|
-
active = '#348FE4'
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface GanttLinkItem {
|
|
31
|
-
id: string;
|
|
32
|
-
before: { x: number; y: number };
|
|
33
|
-
after: { x: number; y: number };
|
|
34
|
-
start: GanttDate;
|
|
35
|
-
end: GanttDate;
|
|
36
|
-
origin: GanttItem;
|
|
37
|
-
links: string[];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
interface LinkInternal {
|
|
41
|
-
path: string;
|
|
42
|
-
source: GanttItem;
|
|
43
|
-
target: GanttItem;
|
|
44
|
-
color: LinkColors;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@Component({
|
|
48
|
-
selector: 'gantt-links-overlay',
|
|
49
|
-
templateUrl: './links.component.html'
|
|
50
|
-
})
|
|
51
|
-
export class GanttLinksComponent implements OnInit, OnChanges, OnDestroy {
|
|
52
|
-
@Input() groups: GanttGroupInternal[] = [];
|
|
53
|
-
|
|
54
|
-
@Input() items: GanttItemInternal[] = [];
|
|
55
|
-
|
|
56
|
-
@Output() lineClick = new EventEmitter<GanttLineClickEvent>();
|
|
57
|
-
|
|
58
|
-
public links: LinkInternal[] = [];
|
|
59
|
-
|
|
60
|
-
private linkItems: GanttLinkItem[] = [];
|
|
61
|
-
|
|
62
|
-
private bezierWeight = -0.5;
|
|
63
|
-
|
|
64
|
-
private firstChange = true;
|
|
65
|
-
|
|
66
|
-
private unsubscribe$ = new Subject();
|
|
67
|
-
|
|
68
|
-
@HostBinding('class.gantt-links-overlay') ganttLinksOverlay = true;
|
|
69
|
-
|
|
70
|
-
constructor(
|
|
71
|
-
@Inject(GANTT_UPPER_TOKEN) public ganttUpper: GanttUpper,
|
|
72
|
-
private cdr: ChangeDetectorRef,
|
|
73
|
-
private elementRef: ElementRef,
|
|
74
|
-
private ganttDragContainer: GanttDragContainer
|
|
75
|
-
) {}
|
|
76
|
-
|
|
77
|
-
ngOnInit() {
|
|
78
|
-
this.buildLinks();
|
|
79
|
-
this.firstChange = false;
|
|
80
|
-
|
|
81
|
-
this.ganttDragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
|
|
82
|
-
this.elementRef.nativeElement.style.visibility = 'hidden';
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
merge(
|
|
86
|
-
this.ganttUpper.viewChange,
|
|
87
|
-
this.ganttUpper.expandChange,
|
|
88
|
-
this.ganttUpper.view.start$,
|
|
89
|
-
this.ganttUpper.dragEnded,
|
|
90
|
-
this.ganttUpper.linkDragEnded
|
|
91
|
-
)
|
|
92
|
-
.pipe(takeUntil(this.unsubscribe$), skip(1))
|
|
93
|
-
.subscribe(() => {
|
|
94
|
-
this.elementRef.nativeElement.style.visibility = 'visible';
|
|
95
|
-
this.buildLinks();
|
|
96
|
-
this.cdr.detectChanges();
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
ngOnChanges() {
|
|
101
|
-
if (!this.firstChange) {
|
|
102
|
-
this.buildLinks();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
private computeItemPosition() {
|
|
107
|
-
const lineHeight = this.ganttUpper.styles.lineHeight;
|
|
108
|
-
const barHeight = this.ganttUpper.styles.barHeight;
|
|
109
|
-
this.linkItems = [];
|
|
110
|
-
if (this.groups.length > 0) {
|
|
111
|
-
let itemNum = 0;
|
|
112
|
-
let groupNum = 0;
|
|
113
|
-
this.groups.forEach((group) => {
|
|
114
|
-
groupNum++;
|
|
115
|
-
if (group.expanded) {
|
|
116
|
-
const items = recursiveItems(group.items);
|
|
117
|
-
items.forEach((item, itemIndex) => {
|
|
118
|
-
const y = (groupNum + itemNum + itemIndex) * lineHeight + item.refs.y + barHeight / 2;
|
|
119
|
-
this.linkItems.push({
|
|
120
|
-
...item,
|
|
121
|
-
before: {
|
|
122
|
-
x: item.refs.x,
|
|
123
|
-
y
|
|
124
|
-
},
|
|
125
|
-
after: {
|
|
126
|
-
x: item.refs.x + item.refs.width,
|
|
127
|
-
y
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
itemNum += items.length;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
} else {
|
|
135
|
-
const items = recursiveItems(this.items);
|
|
136
|
-
items.forEach((item, itemIndex) => {
|
|
137
|
-
const y = itemIndex * lineHeight + item.refs.y + barHeight / 2;
|
|
138
|
-
this.linkItems.push({
|
|
139
|
-
...item,
|
|
140
|
-
before: {
|
|
141
|
-
x: item.refs.x,
|
|
142
|
-
y
|
|
143
|
-
},
|
|
144
|
-
after: {
|
|
145
|
-
x: item.refs.x + item.refs.width,
|
|
146
|
-
y
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
private generatePath(source: GanttLinkItem, target: GanttLinkItem) {
|
|
154
|
-
if (source.before && source.after && target.before && target.after) {
|
|
155
|
-
const x1 = source.after.x;
|
|
156
|
-
const y1 = source.after.y;
|
|
157
|
-
|
|
158
|
-
const x4 = target.before.x;
|
|
159
|
-
const y4 = target.before.y;
|
|
160
|
-
|
|
161
|
-
const dx = Math.abs(x4 - x1) * this.bezierWeight;
|
|
162
|
-
const x2 = x1 - dx;
|
|
163
|
-
const x3 = x4 + dx;
|
|
164
|
-
|
|
165
|
-
const centerX = (x1 + x4) / 2;
|
|
166
|
-
const centerY = (y1 + y4) / 2;
|
|
167
|
-
|
|
168
|
-
let controlX = this.ganttUpper.styles.lineHeight / 2;
|
|
169
|
-
const controlY = this.ganttUpper.styles.lineHeight / 2;
|
|
170
|
-
|
|
171
|
-
if (x1 >= x4) {
|
|
172
|
-
if (y4 > y1) {
|
|
173
|
-
if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
|
|
174
|
-
return `M ${x1} ${y1}
|
|
175
|
-
C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 + controlX} ${x1} ${y1 + controlY}
|
|
176
|
-
L ${x1} ${y1 + controlY} ${centerX} ${centerY}
|
|
177
|
-
|
|
178
|
-
M ${x4} ${y4}
|
|
179
|
-
C ${x4 - controlX} ${y4} ${x4 - controlX} ${y4 - controlX} ${x4} ${y4 - controlY}
|
|
180
|
-
L ${x4} ${y4 - controlY} ${centerX} ${centerY}`;
|
|
181
|
-
} else {
|
|
182
|
-
controlX = this.ganttUpper.styles.lineHeight;
|
|
183
|
-
return `M ${x1} ${y1}
|
|
184
|
-
C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 + controlX} ${centerX} ${centerY}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
M ${x4} ${y4}
|
|
188
|
-
C ${x4 - controlX} ${y4} ${x4 - controlX} ${y4 - controlX} ${centerX} ${centerY}`;
|
|
189
|
-
}
|
|
190
|
-
} else {
|
|
191
|
-
if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
|
|
192
|
-
return `M ${x1} ${y1}
|
|
193
|
-
C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 - controlX} ${x1} ${y1 - controlY}
|
|
194
|
-
L ${x1} ${y1 - controlY} ${centerX} ${centerY}
|
|
195
|
-
|
|
196
|
-
M ${x4} ${y4}
|
|
197
|
-
C ${x4 - controlX} ${y4} ${x4 - controlX} ${y4 + controlX} ${x4} ${y4 + controlY}
|
|
198
|
-
L ${x4} ${y4 + controlY} ${centerX} ${centerY}
|
|
199
|
-
`;
|
|
200
|
-
} else {
|
|
201
|
-
controlX = this.ganttUpper.styles.lineHeight;
|
|
202
|
-
return `M ${x1} ${y1}
|
|
203
|
-
C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 - controlX} ${centerX} ${centerY}
|
|
204
|
-
|
|
205
|
-
M ${x4} ${y4}
|
|
206
|
-
C ${x4 - controlX} ${y4} ${x4 - controlX} ${y4 + controlX} ${centerX} ${centerY}`;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
buildLinks() {
|
|
216
|
-
this.computeItemPosition();
|
|
217
|
-
this.links = [];
|
|
218
|
-
this.linkItems.forEach((source) => {
|
|
219
|
-
if (source.origin.start || source.origin.end) {
|
|
220
|
-
source.links.forEach((linkId) => {
|
|
221
|
-
const target = this.linkItems.find((item) => item.id === linkId);
|
|
222
|
-
if (target && (target.origin.start || target.origin.end)) {
|
|
223
|
-
this.links.push({
|
|
224
|
-
path: this.generatePath(source, target),
|
|
225
|
-
source: source.origin,
|
|
226
|
-
target: target.origin,
|
|
227
|
-
color: source.end.getTime() > target.start.getTime() ? LinkColors.blocked : LinkColors.default
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
trackBy(index: number) {
|
|
236
|
-
return index;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
onLineClick(event: MouseEvent, link: LinkInternal) {
|
|
240
|
-
this.lineClick.emit({
|
|
241
|
-
event,
|
|
242
|
-
source: link.source,
|
|
243
|
-
target: link.target
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
mouseEnterPath(link: LinkInternal) {
|
|
248
|
-
if (link.color === LinkColors.default) {
|
|
249
|
-
link.color = LinkColors.active;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
mouseLeavePath(link: LinkInternal) {
|
|
254
|
-
if (link.color === LinkColors.active) {
|
|
255
|
-
link.color = LinkColors.default;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
ngOnDestroy() {
|
|
260
|
-
this.unsubscribe$.next();
|
|
261
|
-
this.unsubscribe$.complete();
|
|
262
|
-
}
|
|
263
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<gantt-links-overlay [groups]="groups" [items]="items" (lineClick)="lineClick.emit($event)"></gantt-links-overlay>
|
|
2
|
-
<!-- groups -->
|
|
3
|
-
<div class="gantt-main-groups" *ngIf="groups && groups.length > 0; else itemsTemplate" [style.width.px]="ganttUpper.view.width">
|
|
4
|
-
<ng-container *ngFor="let group of groups; trackBy: trackBy">
|
|
5
|
-
<div class="gantt-group" [ngClass]="group.class">
|
|
6
|
-
<ng-template [ngTemplateOutlet]="groupHeaderTemplate" [ngTemplateOutletContext]="{ group: group }"></ng-template>
|
|
7
|
-
</div>
|
|
8
|
-
<div *ngIf="group.expanded" class="gantt-items">
|
|
9
|
-
<ng-template [ngTemplateOutlet]="ganttItems" [ngTemplateOutletContext]="{ items: group.items }"></ng-template>
|
|
10
|
-
</div>
|
|
11
|
-
</ng-container>
|
|
12
|
-
</div>
|
|
13
|
-
<!-- items -->
|
|
14
|
-
<ng-template #itemsTemplate>
|
|
15
|
-
<div class="gantt-main-items" [style.width.px]="ganttUpper.view.width">
|
|
16
|
-
<ng-template [ngTemplateOutlet]="ganttItems" [ngTemplateOutletContext]="{ items: items }"></ng-template>
|
|
17
|
-
</div>
|
|
18
|
-
</ng-template>
|
|
19
|
-
|
|
20
|
-
<ng-template #ganttItems let-items="items">
|
|
21
|
-
<ng-container *ngFor="let item of items; trackBy: trackBy">
|
|
22
|
-
<div class="gantt-item" [style.height.px]="ganttUpper.styles.lineHeight">
|
|
23
|
-
<ng-container *ngIf="item.type | isGanttCustomItem">
|
|
24
|
-
<ng-template [ngTemplateOutlet]="itemTemplate" [ngTemplateOutletContext]="{ item: item.origin, refs: item.refs }"></ng-template>
|
|
25
|
-
</ng-container>
|
|
26
|
-
<gantt-range *ngIf="item.type | isGanttRangeItem" [template]="rangeTemplate" [item]="item"></gantt-range>
|
|
27
|
-
<gantt-bar *ngIf="item.type | isGanttBarItem" [item]="item" [template]="barTemplate" (barClick)="barClick.emit($event)"></gantt-bar>
|
|
28
|
-
</div>
|
|
29
|
-
<ng-template
|
|
30
|
-
*ngIf="item.children && item.expanded"
|
|
31
|
-
[ngTemplateOutlet]="ganttItems"
|
|
32
|
-
[ngTemplateOutletContext]="{ items: item.children }"
|
|
33
|
-
></ng-template>
|
|
34
|
-
</ng-container>
|
|
35
|
-
</ng-template>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, HostBinding, Inject, Input, TemplateRef, Output, EventEmitter } from '@angular/core';
|
|
2
|
-
import { GanttGroupInternal, GanttItemInternal, GanttBarClickEvent, GanttLineClickEvent } from '../../class';
|
|
3
|
-
import { GANTT_UPPER_TOKEN, GanttUpper } from '../../gantt-upper';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'gantt-main',
|
|
7
|
-
templateUrl: './gantt-main.component.html'
|
|
8
|
-
})
|
|
9
|
-
export class GanttMainComponent implements OnInit {
|
|
10
|
-
@Input() groups: GanttGroupInternal[];
|
|
11
|
-
|
|
12
|
-
@Input() items: GanttItemInternal[];
|
|
13
|
-
|
|
14
|
-
@Input() groupHeaderTemplate: TemplateRef<any>;
|
|
15
|
-
|
|
16
|
-
@Input() itemTemplate: TemplateRef<any>;
|
|
17
|
-
|
|
18
|
-
@Input() barTemplate: TemplateRef<any>;
|
|
19
|
-
|
|
20
|
-
@Input() rangeTemplate: TemplateRef<any>;
|
|
21
|
-
|
|
22
|
-
@Output() barClick = new EventEmitter<GanttBarClickEvent>();
|
|
23
|
-
|
|
24
|
-
@Output() lineClick = new EventEmitter<GanttLineClickEvent>();
|
|
25
|
-
|
|
26
|
-
@HostBinding('class.gantt-main-container') ganttMainClass = true;
|
|
27
|
-
|
|
28
|
-
constructor(@Inject(GANTT_UPPER_TOKEN) public ganttUpper: GanttUpper) {}
|
|
29
|
-
|
|
30
|
-
ngOnInit() {}
|
|
31
|
-
|
|
32
|
-
trackBy(item: GanttGroupInternal | GanttItemInternal, index: number) {
|
|
33
|
-
return item.id || index;
|
|
34
|
-
}
|
|
35
|
-
}
|