@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,77 +0,0 @@
|
|
|
1
|
-
.gantt {
|
|
2
|
-
width: 100%;
|
|
3
|
-
height: 100%;
|
|
4
|
-
background-color: $gantt-bg-color;
|
|
5
|
-
position: relative;
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
display: flex;
|
|
8
|
-
color: $gantt-color;
|
|
9
|
-
opacity: 0;
|
|
10
|
-
|
|
11
|
-
svg {
|
|
12
|
-
overflow: visible !important;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.gantt-side {
|
|
16
|
-
border-right: 1px solid $gantt-border-color;
|
|
17
|
-
position: relative;
|
|
18
|
-
z-index: 3;
|
|
19
|
-
// overflow-x: scroll;
|
|
20
|
-
box-shadow: $gantt-side-shadow;
|
|
21
|
-
|
|
22
|
-
.gantt-side-header {
|
|
23
|
-
box-sizing: border-box;
|
|
24
|
-
height: $gantt-header-height;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.gantt-side-container {
|
|
28
|
-
height: 100%;
|
|
29
|
-
background-color: $gantt-bg-color;
|
|
30
|
-
overflow-y: auto;
|
|
31
|
-
|
|
32
|
-
&::-webkit-scrollbar {
|
|
33
|
-
display: none;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.gantt-container {
|
|
39
|
-
flex: 1;
|
|
40
|
-
position: relative;
|
|
41
|
-
display: flex;
|
|
42
|
-
overflow: hidden;
|
|
43
|
-
background-color: $gantt-container-background-color;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.gantt-main-container {
|
|
47
|
-
width: 100%;
|
|
48
|
-
height: calc(100% - #{$gantt-header-height});
|
|
49
|
-
flex: 1;
|
|
50
|
-
position: absolute;
|
|
51
|
-
top: $gantt-header-height;
|
|
52
|
-
bottom: 0;
|
|
53
|
-
left: 0;
|
|
54
|
-
right: 0;
|
|
55
|
-
overflow: auto;
|
|
56
|
-
background-color: $gantt-container-background-color;
|
|
57
|
-
|
|
58
|
-
.gantt-main-groups,
|
|
59
|
-
.gantt-main-items {
|
|
60
|
-
overflow: hidden;
|
|
61
|
-
min-height: 100%;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.gantt-group {
|
|
65
|
-
height: $gantt-group-height;
|
|
66
|
-
background: $gantt-group-background-color;
|
|
67
|
-
border-bottom: 1px solid $gantt-border-color;
|
|
68
|
-
box-sizing: border-box;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.gantt-item {
|
|
72
|
-
border-bottom: 1px solid $gantt-border-color;
|
|
73
|
-
box-sizing: border-box;
|
|
74
|
-
position: relative;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Component,
|
|
3
|
-
OnInit,
|
|
4
|
-
ElementRef,
|
|
5
|
-
ChangeDetectionStrategy,
|
|
6
|
-
Input,
|
|
7
|
-
EventEmitter,
|
|
8
|
-
Output,
|
|
9
|
-
ChangeDetectorRef,
|
|
10
|
-
NgZone,
|
|
11
|
-
OnChanges,
|
|
12
|
-
OnDestroy,
|
|
13
|
-
SimpleChanges,
|
|
14
|
-
ContentChildren,
|
|
15
|
-
QueryList,
|
|
16
|
-
AfterViewInit,
|
|
17
|
-
ContentChild,
|
|
18
|
-
TemplateRef,
|
|
19
|
-
forwardRef
|
|
20
|
-
} from '@angular/core';
|
|
21
|
-
import { startWith, takeUntil, take, finalize } from 'rxjs/operators';
|
|
22
|
-
import { Subject, Observable } from 'rxjs';
|
|
23
|
-
import { GanttUpper, GANTT_UPPER_TOKEN } from './gantt-upper';
|
|
24
|
-
import { GanttLinkDragEvent, GanttLineClickEvent, GanttItemInternal, GanttItem } from './class';
|
|
25
|
-
import { NgxGanttTableColumnComponent } from './table/gantt-column.component';
|
|
26
|
-
import { sideWidth } from './gantt.styles';
|
|
27
|
-
import { coerceCssPixelValue } from '@angular/cdk/coercion';
|
|
28
|
-
import { NgxGanttTableComponent } from './table/gantt-table.component';
|
|
29
|
-
import { GANTT_ABSTRACT_TOKEN } from './gantt-abstract';
|
|
30
|
-
import { defaultColumnWidth } from './components/table/gantt-table.component';
|
|
31
|
-
@Component({
|
|
32
|
-
selector: 'ngx-gantt',
|
|
33
|
-
templateUrl: './gantt.component.html',
|
|
34
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
35
|
-
providers: [
|
|
36
|
-
{
|
|
37
|
-
provide: GANTT_UPPER_TOKEN,
|
|
38
|
-
useExisting: NgxGanttComponent
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
provide: GANTT_ABSTRACT_TOKEN,
|
|
42
|
-
useExisting: forwardRef(() => NgxGanttComponent)
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
})
|
|
46
|
-
export class NgxGanttComponent extends GanttUpper implements OnInit, AfterViewInit, OnChanges, OnDestroy {
|
|
47
|
-
@Input() maxLevel = 2;
|
|
48
|
-
|
|
49
|
-
@Input() async: boolean;
|
|
50
|
-
|
|
51
|
-
@Input() childrenResolve: (GanttItem) => Observable<GanttItem[]>;
|
|
52
|
-
|
|
53
|
-
@Input() linkable: boolean;
|
|
54
|
-
|
|
55
|
-
@Output() linkDragStarted = new EventEmitter<GanttLinkDragEvent>();
|
|
56
|
-
|
|
57
|
-
@Output() linkDragEnded = new EventEmitter<GanttLinkDragEvent>();
|
|
58
|
-
|
|
59
|
-
@Output() lineClick = new EventEmitter<GanttLineClickEvent>();
|
|
60
|
-
|
|
61
|
-
@ContentChild(NgxGanttTableComponent) table: NgxGanttTableComponent;
|
|
62
|
-
|
|
63
|
-
@ContentChildren(NgxGanttTableColumnComponent, { descendants: true }) columns: QueryList<NgxGanttTableColumnComponent>;
|
|
64
|
-
|
|
65
|
-
@ContentChild('tableEmpty', { static: true }) tableEmptyTemplate: TemplateRef<any>;
|
|
66
|
-
|
|
67
|
-
private ngUnsubscribe$ = new Subject();
|
|
68
|
-
|
|
69
|
-
public sideTableWidth = sideWidth;
|
|
70
|
-
|
|
71
|
-
constructor(elementRef: ElementRef<HTMLElement>, cdr: ChangeDetectorRef, ngZone: NgZone) {
|
|
72
|
-
super(elementRef, cdr, ngZone);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
ngOnInit() {
|
|
76
|
-
super.onInit();
|
|
77
|
-
|
|
78
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
79
|
-
this.dragContainer.linkDragStarted.pipe(takeUntil(this.ngUnsubscribe$)).subscribe((event: GanttLinkDragEvent) => {
|
|
80
|
-
this.linkDragStarted.emit(event);
|
|
81
|
-
});
|
|
82
|
-
this.dragContainer.linkDragEnded.pipe(takeUntil(this.ngUnsubscribe$)).subscribe((event: GanttLinkDragEvent) => {
|
|
83
|
-
this.linkDragEnded.emit(event);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
ngAfterViewInit() {
|
|
89
|
-
this.columns.changes.pipe(startWith(true), takeUntil(this.ngUnsubscribe$)).subscribe(() => {
|
|
90
|
-
this.columns.forEach((column) => {
|
|
91
|
-
if (!column.columnWidth) {
|
|
92
|
-
column.columnWidth = coerceCssPixelValue(defaultColumnWidth);
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
this.cdr.detectChanges();
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
ngOnChanges(changes: SimpleChanges) {
|
|
100
|
-
super.onChanges(changes);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
expandChildren(item: GanttItemInternal) {
|
|
104
|
-
if (!item.expanded) {
|
|
105
|
-
item.setExpand(true);
|
|
106
|
-
if (this.async && this.childrenResolve && item.children.length === 0) {
|
|
107
|
-
item.loading = true;
|
|
108
|
-
this.childrenResolve(item.origin)
|
|
109
|
-
.pipe(
|
|
110
|
-
take(1),
|
|
111
|
-
finalize(() => {
|
|
112
|
-
item.loading = false;
|
|
113
|
-
this.expandChange.emit();
|
|
114
|
-
this.cdr.detectChanges();
|
|
115
|
-
})
|
|
116
|
-
)
|
|
117
|
-
.subscribe((items) => {
|
|
118
|
-
item.addChildren(items);
|
|
119
|
-
this.computeItemsRefs(...item.children);
|
|
120
|
-
});
|
|
121
|
-
} else {
|
|
122
|
-
this.computeItemsRefs(...item.children);
|
|
123
|
-
this.expandChange.emit();
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
item.setExpand(false);
|
|
127
|
-
this.expandChange.emit();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
ngOnDestroy() {
|
|
132
|
-
super.onDestroy();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { NgxGanttComponent } from './gantt.component';
|
|
4
|
-
import { NgxGanttTableComponent } from './table/gantt-table.component';
|
|
5
|
-
import { NgxGanttTableColumnComponent } from './table/gantt-column.component';
|
|
6
|
-
import { GanttCalendarComponent } from './components/calendar/calendar.component';
|
|
7
|
-
import { GanttTableComponent } from './components/table/gantt-table.component';
|
|
8
|
-
import { NgxGanttBarComponent } from './components/bar/bar.component';
|
|
9
|
-
import { GanttMainComponent } from './components/main/gantt-main.component';
|
|
10
|
-
import { GanttIconComponent } from './components/icon/icon.component';
|
|
11
|
-
import { GanttDragBackdropComponent } from './components/drag-backdrop/drag-backdrop.component';
|
|
12
|
-
import { GanttLinksComponent } from './components/links/links.component';
|
|
13
|
-
import { NgxGanttRootComponent } from './root.component';
|
|
14
|
-
import { NgxGanttRangeComponent } from './components/range/range.component';
|
|
15
|
-
import { IsGanttRangeItemPipe, IsGanttBarItemPipe, IsGanttCustomItemPipe } from './gantt.pipe';
|
|
16
|
-
import { DragDropModule } from '@angular/cdk/drag-drop';
|
|
17
|
-
|
|
18
|
-
@NgModule({
|
|
19
|
-
imports: [CommonModule, DragDropModule],
|
|
20
|
-
exports: [
|
|
21
|
-
NgxGanttComponent,
|
|
22
|
-
NgxGanttTableComponent,
|
|
23
|
-
NgxGanttTableColumnComponent,
|
|
24
|
-
NgxGanttRootComponent,
|
|
25
|
-
NgxGanttBarComponent,
|
|
26
|
-
NgxGanttRangeComponent
|
|
27
|
-
],
|
|
28
|
-
declarations: [
|
|
29
|
-
NgxGanttComponent,
|
|
30
|
-
NgxGanttTableComponent,
|
|
31
|
-
NgxGanttTableColumnComponent,
|
|
32
|
-
GanttTableComponent,
|
|
33
|
-
GanttMainComponent,
|
|
34
|
-
GanttCalendarComponent,
|
|
35
|
-
GanttLinksComponent,
|
|
36
|
-
NgxGanttBarComponent,
|
|
37
|
-
GanttIconComponent,
|
|
38
|
-
GanttDragBackdropComponent,
|
|
39
|
-
NgxGanttRangeComponent,
|
|
40
|
-
NgxGanttRootComponent,
|
|
41
|
-
IsGanttRangeItemPipe,
|
|
42
|
-
IsGanttBarItemPipe,
|
|
43
|
-
IsGanttCustomItemPipe
|
|
44
|
-
],
|
|
45
|
-
providers: []
|
|
46
|
-
})
|
|
47
|
-
export class NgxGanttModule {}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
import { GanttItemType } from './class';
|
|
3
|
-
|
|
4
|
-
@Pipe({
|
|
5
|
-
name: 'isGanttRangeItem'
|
|
6
|
-
})
|
|
7
|
-
export class IsGanttRangeItemPipe implements PipeTransform {
|
|
8
|
-
transform(value: GanttItemType) {
|
|
9
|
-
return value === GanttItemType.range;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@Pipe({
|
|
15
|
-
name: 'isGanttBarItem'
|
|
16
|
-
})
|
|
17
|
-
export class IsGanttBarItemPipe implements PipeTransform {
|
|
18
|
-
transform(value: GanttItemType) {
|
|
19
|
-
return value === GanttItemType.bar;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@Pipe({
|
|
25
|
-
name: 'isGanttCustomItem'
|
|
26
|
-
})
|
|
27
|
-
export class IsGanttCustomItemPipe implements PipeTransform {
|
|
28
|
-
transform(value: GanttItemType) {
|
|
29
|
-
return value === GanttItemType.custom;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export const defaultStyles = {
|
|
2
|
-
lineHeight: 44,
|
|
3
|
-
barHeight: 22
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
export const headerHeight = 44;
|
|
7
|
-
|
|
8
|
-
export type GanttStyles = typeof defaultStyles;
|
|
9
|
-
|
|
10
|
-
export const sideWidth = 400;
|
|
11
|
-
|
|
12
|
-
export const sideMiddleWidth = 500;
|
|
13
|
-
|
|
14
|
-
export const sideMaxWidth = 600;
|
|
15
|
-
|
|
16
|
-
export const sideMinWidth = 400;
|
|
17
|
-
|
|
18
|
-
export const barBackground = '#348fe4';
|
|
19
|
-
|
|
20
|
-
export const rangeHeight = 17;
|
|
21
|
-
|
|
22
|
-
export const todayHeight = 24;
|
|
23
|
-
|
|
24
|
-
export const todayWidth = 35;
|
|
25
|
-
|
|
26
|
-
export const todayBorderRadius = 4;
|
|
27
|
-
|
|
28
|
-
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<div class="gantt-side" [style.width.px]="sideWidth">
|
|
2
|
-
<div class="gantt-side-container">
|
|
3
|
-
<ng-template [ngTemplateOutlet]="sideTemplate"></ng-template>
|
|
4
|
-
</div>
|
|
5
|
-
</div>
|
|
6
|
-
<div class="gantt-container">
|
|
7
|
-
<gantt-calendar-overlay></gantt-calendar-overlay>
|
|
8
|
-
<gantt-drag-backdrop></gantt-drag-backdrop>
|
|
9
|
-
<div class="gantt-main">
|
|
10
|
-
<ng-template [ngTemplateOutlet]="mainTemplate"></ng-template>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Component,
|
|
3
|
-
OnInit,
|
|
4
|
-
HostBinding,
|
|
5
|
-
NgZone,
|
|
6
|
-
ElementRef,
|
|
7
|
-
Inject,
|
|
8
|
-
ContentChild,
|
|
9
|
-
TemplateRef,
|
|
10
|
-
Input,
|
|
11
|
-
Optional,
|
|
12
|
-
AfterViewInit
|
|
13
|
-
} from '@angular/core';
|
|
14
|
-
import { GanttDomService, ScrollDirection } from './gantt-dom.service';
|
|
15
|
-
import { GanttDragContainer } from './gantt-drag-container';
|
|
16
|
-
import { take, takeUntil, startWith } from 'rxjs/operators';
|
|
17
|
-
import { Subject } from 'rxjs';
|
|
18
|
-
import { GanttUpper, GANTT_UPPER_TOKEN } from './gantt-upper';
|
|
19
|
-
import { GanttPrintService } from './gantt-print.service';
|
|
20
|
-
|
|
21
|
-
@Component({
|
|
22
|
-
selector: 'ngx-gantt-root',
|
|
23
|
-
templateUrl: './root.component.html',
|
|
24
|
-
providers: [GanttDomService, GanttDragContainer]
|
|
25
|
-
})
|
|
26
|
-
export class NgxGanttRootComponent implements OnInit {
|
|
27
|
-
@Input() sideWidth: number;
|
|
28
|
-
|
|
29
|
-
@HostBinding('class.gantt') ganttClass = true;
|
|
30
|
-
|
|
31
|
-
@ContentChild('sideTemplate', { static: true }) sideTemplate: TemplateRef<any>;
|
|
32
|
-
|
|
33
|
-
@ContentChild('mainTemplate', { static: true }) mainTemplate: TemplateRef<any>;
|
|
34
|
-
|
|
35
|
-
private unsubscribe$ = new Subject();
|
|
36
|
-
|
|
37
|
-
private get view() {
|
|
38
|
-
return this.ganttUpper.view;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
constructor(
|
|
42
|
-
private elementRef: ElementRef<HTMLElement>,
|
|
43
|
-
private ngZone: NgZone,
|
|
44
|
-
private dom: GanttDomService,
|
|
45
|
-
public dragContainer: GanttDragContainer,
|
|
46
|
-
@Inject(GANTT_UPPER_TOKEN) private ganttUpper: GanttUpper,
|
|
47
|
-
@Optional() private printService: GanttPrintService
|
|
48
|
-
) {
|
|
49
|
-
this.ganttUpper.dragContainer = dragContainer;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
ngOnInit() {
|
|
53
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
54
|
-
this.dom.initialize(this.elementRef);
|
|
55
|
-
if (this.printService) {
|
|
56
|
-
this.printService.register(this.elementRef);
|
|
57
|
-
}
|
|
58
|
-
this.setupScrollClass();
|
|
59
|
-
this.setupResize();
|
|
60
|
-
this.setupViewScroll();
|
|
61
|
-
// 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
|
|
62
|
-
this.elementRef.nativeElement.style.opacity = '1';
|
|
63
|
-
this.ganttUpper.viewChange.pipe(startWith(null)).subscribe(() => {
|
|
64
|
-
this.scrollToToday();
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
private setupViewScroll() {
|
|
70
|
-
if (this.ganttUpper.disabledLoadOnScroll) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
this.dom
|
|
74
|
-
.getViewerScroll()
|
|
75
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
76
|
-
.subscribe((event) => {
|
|
77
|
-
if (event.direction === ScrollDirection.LEFT) {
|
|
78
|
-
const dates = this.view.addStartDate();
|
|
79
|
-
if (dates) {
|
|
80
|
-
event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
|
|
81
|
-
this.ngZone.run(() => {
|
|
82
|
-
this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() });
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (event.direction === ScrollDirection.RIGHT) {
|
|
87
|
-
const dates = this.view.addEndDate();
|
|
88
|
-
if (dates) {
|
|
89
|
-
this.ngZone.run(() => {
|
|
90
|
-
this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() });
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
private setupResize() {
|
|
98
|
-
this.dom
|
|
99
|
-
.getResize()
|
|
100
|
-
.pipe(takeUntil(this.unsubscribe$))
|
|
101
|
-
.subscribe(() => {
|
|
102
|
-
this.setupScrollClass();
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
private setupScrollClass() {
|
|
107
|
-
const mainContainer = this.dom.mainContainer as HTMLElement;
|
|
108
|
-
const height = mainContainer.offsetHeight;
|
|
109
|
-
const scrollHeight = mainContainer.scrollHeight;
|
|
110
|
-
if (scrollHeight > height) {
|
|
111
|
-
this.elementRef.nativeElement.className = 'gantt gantt-scroll';
|
|
112
|
-
} else {
|
|
113
|
-
this.elementRef.nativeElement.className = 'gantt';
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
private scrollToToday() {
|
|
118
|
-
const x = this.view.getTodayXPoint();
|
|
119
|
-
this.dom.scrollMainContainer(x);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
@import './variables.scss';
|
|
2
|
-
@import '../gantt.component.scss';
|
|
3
|
-
@import '../components/table/gantt-table.component.scss';
|
|
4
|
-
@import '../components/calendar/calendar.component.scss';
|
|
5
|
-
@import '../components/drag-backdrop/drag-backdrop.component.scss';
|
|
6
|
-
@import '../components/bar/bar.component.scss';
|
|
7
|
-
@import '../components/range/range.component.scss';
|
|
8
|
-
@import '../components/icon/icon.component.scss';
|
|
9
|
-
@import '../components/links/links.component.scss';
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// basic
|
|
2
|
-
$gantt-color: #333 !default;
|
|
3
|
-
$gantt-header-height: 44px !default;
|
|
4
|
-
$gantt-border-color: #eee !default;
|
|
5
|
-
$gantt-bg-color: #fff !default;
|
|
6
|
-
$gantt-side-shadow: 12px 0 16px -10px rgba(0, 0, 0, 0.15) !default;
|
|
7
|
-
$gantt-container-background-color: #fafafa !default;
|
|
8
|
-
$gantt-item-height: 44px !default;
|
|
9
|
-
$gantt-group-background-color: rgba(
|
|
10
|
-
$color: #f3f3f3,
|
|
11
|
-
$alpha: 0.5
|
|
12
|
-
) !default;
|
|
13
|
-
$gantt-group-height: 44px !default;
|
|
14
|
-
$gantt-table-td-padding: 0 15px !default;
|
|
15
|
-
|
|
16
|
-
// calendar
|
|
17
|
-
$gantt-date-primary-color: #888 !default;
|
|
18
|
-
$gantt-date-primary-font-size: 14px !default;
|
|
19
|
-
$gantt-date-primary-border: #ddd !default;
|
|
20
|
-
$gantt-date-secondary-color: #333 !default;
|
|
21
|
-
$gantt-date-secondary-font-size: 14px !default;
|
|
22
|
-
$gantt-date-secondary-weekend-color: #aaa !default;
|
|
23
|
-
$gantt-date-week-backdrop-bg: rgba(
|
|
24
|
-
$color: #f3f3f3,
|
|
25
|
-
$alpha: 0.5
|
|
26
|
-
) !default;
|
|
27
|
-
$gantt-date-today-color: #ff9f73 !default;
|
|
28
|
-
$gantt-date-today-text-color: #fff !default;
|
|
29
|
-
|
|
30
|
-
// bar
|
|
31
|
-
$gantt-bar-bg: #fff !default;
|
|
32
|
-
$gantt-bar-layer-bg: #fff !default;
|
|
33
|
-
$gantt-bar-handle-color: #cacaca !default;
|
|
34
|
-
$gantt-bar-handle-height: 12px !default;
|
|
35
|
-
$gantt-bar-background-color: #348fe4 !default;
|
|
36
|
-
|
|
37
|
-
// drag
|
|
38
|
-
$gantt-item-drag-mask-color: #348fe4 !default;
|
|
39
|
-
$gantt-link-dragging-line-color: #348fe4 !default;
|
|
40
|
-
|
|
41
|
-
// link
|
|
42
|
-
$gantt-link-line-color: #348fe4 !default;
|
|
43
|
-
|
|
44
|
-
// table
|
|
45
|
-
$gantt-table-header-drag-line-width: 3px !default;
|
|
46
|
-
$gantt-table-header-drag-line-color: #348fe4 !default;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit, ContentChild, TemplateRef, Input, EventEmitter, Inject, Output } from '@angular/core';
|
|
2
|
-
import { coerceCssPixelValue } from '@angular/cdk/coercion';
|
|
3
|
-
import { GanttUpper, GANTT_UPPER_TOKEN } from '../gantt-upper';
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'ngx-gantt-column',
|
|
6
|
-
template: ''
|
|
7
|
-
})
|
|
8
|
-
export class NgxGanttTableColumnComponent implements OnInit {
|
|
9
|
-
public columnWidth: string;
|
|
10
|
-
|
|
11
|
-
@Input()
|
|
12
|
-
set width(width: number | string) {
|
|
13
|
-
this.columnWidth = coerceCssPixelValue(width);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@Input() name: string;
|
|
17
|
-
|
|
18
|
-
@ContentChild('cell', { static: true }) templateRef: TemplateRef<any>;
|
|
19
|
-
|
|
20
|
-
@ContentChild('header', { static: true }) headerTemplateRef: TemplateRef<any>;
|
|
21
|
-
|
|
22
|
-
constructor(@Inject(GANTT_UPPER_TOKEN) public ganttUpper: GanttUpper) {}
|
|
23
|
-
|
|
24
|
-
ngOnInit() {}
|
|
25
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
|
2
|
-
import { GanttTableEvent } from '../class';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'ngx-gantt-table',
|
|
6
|
-
template: ''
|
|
7
|
-
})
|
|
8
|
-
export class NgxGanttTableComponent implements OnInit {
|
|
9
|
-
@Output() columnChanges = new EventEmitter<GanttTableEvent>();
|
|
10
|
-
|
|
11
|
-
constructor() {}
|
|
12
|
-
|
|
13
|
-
ngOnInit() {}
|
|
14
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { TestBed, ComponentFixture, async } from '@angular/core/testing';
|
|
2
|
-
import { Component, ViewChild, DebugElement } from '@angular/core';
|
|
3
|
-
import { NgxGanttModule } from 'ngx-gantt';
|
|
4
|
-
import { GanttTableComponent } from '../../components/table/gantt-table.component';
|
|
5
|
-
import { getMockGroupItems, getMockGroups } from '../../test/mocks/data';
|
|
6
|
-
import { By } from '@angular/platform-browser';
|
|
7
|
-
|
|
8
|
-
@Component({
|
|
9
|
-
selector: 'test-gantt-table',
|
|
10
|
-
template: `
|
|
11
|
-
<ngx-gantt #gantt [items]="items" [groups]="groups">
|
|
12
|
-
<ngx-gantt-table>
|
|
13
|
-
<ngx-gantt-column [width]="200" name="标题">
|
|
14
|
-
<ng-template #cell let-item="item">
|
|
15
|
-
{{ item.title }}
|
|
16
|
-
</ng-template>
|
|
17
|
-
</ngx-gantt-column>
|
|
18
|
-
</ngx-gantt-table>
|
|
19
|
-
</ngx-gantt>
|
|
20
|
-
`,
|
|
21
|
-
providers: []
|
|
22
|
-
})
|
|
23
|
-
export class TestGanttTableComponent {
|
|
24
|
-
@ViewChild(GanttTableComponent, { static: true }) ganttTableComponent: GanttTableComponent;
|
|
25
|
-
|
|
26
|
-
items = getMockGroupItems();
|
|
27
|
-
|
|
28
|
-
groups = getMockGroups();
|
|
29
|
-
|
|
30
|
-
constructor() {}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
describe('NgxGanttTableComponent', () => {
|
|
34
|
-
let component: TestGanttTableComponent;
|
|
35
|
-
let fixture: ComponentFixture<TestGanttTableComponent>;
|
|
36
|
-
|
|
37
|
-
beforeEach(async(() => {
|
|
38
|
-
TestBed.configureTestingModule({
|
|
39
|
-
imports: [NgxGanttModule],
|
|
40
|
-
declarations: [TestGanttTableComponent]
|
|
41
|
-
}).compileComponents();
|
|
42
|
-
}));
|
|
43
|
-
|
|
44
|
-
beforeEach(() => {
|
|
45
|
-
fixture = TestBed.createComponent(TestGanttTableComponent);
|
|
46
|
-
component = fixture.componentInstance;
|
|
47
|
-
fixture.detectChanges();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should create ngx-gantt-table', () => {
|
|
51
|
-
expect(component).toBeDefined();
|
|
52
|
-
const ganttTable: DebugElement = fixture.debugElement.query(By.directive(GanttTableComponent));
|
|
53
|
-
expect(ganttTable).toBeTruthy();
|
|
54
|
-
expect(ganttTable.nativeElement).toBeTruthy();
|
|
55
|
-
});
|
|
56
|
-
});
|