@worktile/gantt 12.0.0 → 12.0.1
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/.all-contributorsrc +53 -0
- package/.angulardoc.json +4 -0
- package/.circleci/config.yml +17 -0
- package/.coveralls.yml +1 -0
- package/.docgenirc.js +64 -0
- package/.editorconfig +22 -0
- package/.prettierrc +24 -0
- package/.travis.yml +23 -0
- package/CHANGELOG.md +564 -0
- package/Dockerfile +4 -0
- package/LICENSE +21 -0
- package/README.md +116 -13
- package/angular.json +136 -0
- package/docs/guides/basic/components.md +54 -0
- package/docs/guides/basic/event.md +70 -0
- package/docs/guides/basic/index.md +4 -0
- package/docs/guides/basic/style.md +68 -0
- package/docs/guides/basic/type.md +70 -0
- package/docs/guides/basic/usage.md +189 -0
- package/docs/guides/index.md +5 -0
- package/docs/guides/intro/getting-started.md +79 -0
- package/docs/guides/intro/index.md +51 -0
- package/docs/index.md +0 -0
- package/example/browserslist +12 -0
- package/example/src/app/app-routing.module.ts +26 -0
- package/example/src/app/app.component.html +2 -0
- package/example/src/app/app.component.ts +11 -0
- package/example/src/app/app.module.ts +57 -0
- package/example/src/app/components/components.component.html +6 -0
- package/example/src/app/components/components.component.ts +33 -0
- package/example/src/app/configuration/parameters/api/zh-cn.js +350 -0
- package/example/src/app/configuration/parameters/doc/zh-cn.md +5 -0
- package/example/src/app/gantt/gantt.component.html +51 -0
- package/example/src/app/gantt/gantt.component.ts +119 -0
- package/example/src/app/gantt-advanced/component/flat.component.html +30 -0
- package/example/src/app/gantt-advanced/component/flat.component.ts +72 -0
- package/example/src/app/gantt-advanced/component/flat.scss +31 -0
- package/example/src/app/gantt-advanced/gantt-advanced.component.html +32 -0
- package/example/src/app/gantt-advanced/gantt-advanced.component.ts +34 -0
- package/example/src/app/gantt-advanced/mocks.ts +158 -0
- package/example/src/app/gantt-groups/gantt-groups.component.html +42 -0
- package/example/src/app/gantt-groups/gantt-groups.component.ts +62 -0
- package/example/src/app/gantt-range/gantt-range.component.html +66 -0
- package/example/src/app/gantt-range/gantt-range.component.ts +67 -0
- package/example/src/app/gantt-range/mocks.ts +150 -0
- package/example/src/app/helper.ts +38 -0
- package/example/src/assets/.gitkeep +0 -0
- package/example/src/environments/environment.prod.ts +3 -0
- package/example/src/environments/environment.ts +16 -0
- package/example/src/favicon.ico +0 -0
- package/example/src/index.html +13 -0
- package/example/src/main.ts +12 -0
- package/example/src/polyfills.ts +63 -0
- package/example/src/styles.scss +56 -0
- package/example/tsconfig.app.json +18 -0
- package/nginx.conf +17 -0
- package/package.json +113 -17
- package/packages/gantt/README.md +24 -0
- package/packages/gantt/karma.conf.js +46 -0
- package/packages/gantt/ng-package.json +7 -0
- package/packages/gantt/ng-package.prod.json +7 -0
- package/packages/gantt/package.json +16 -0
- package/packages/gantt/src/class/date-point.ts +14 -0
- package/{class/event.d.ts → packages/gantt/src/class/event.ts} +12 -6
- package/packages/gantt/src/class/group.ts +36 -0
- package/{class/index.d.ts → packages/gantt/src/class/index.ts} +0 -0
- package/packages/gantt/src/class/item.ts +129 -0
- package/packages/gantt/src/class/test/group.spec.ts +21 -0
- package/packages/gantt/src/class/test/item.spec.ts +102 -0
- package/packages/gantt/src/class/view-type.ts +7 -0
- package/packages/gantt/src/components/bar/bar-drag.ts +298 -0
- package/packages/gantt/src/components/bar/bar.component.html +17 -0
- package/packages/gantt/src/components/bar/bar.component.scss +169 -0
- package/packages/gantt/src/components/bar/bar.component.ts +109 -0
- package/packages/gantt/src/components/bar/test/bar.component.spec.ts +54 -0
- package/packages/gantt/src/components/bar/test/bar.drag.spec.ts +196 -0
- package/packages/gantt/src/components/calendar/calendar.component.html +52 -0
- package/packages/gantt/src/components/calendar/calendar.component.scss +77 -0
- package/packages/gantt/src/components/calendar/calendar.component.ts +100 -0
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.html +6 -0
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.scss +48 -0
- package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.ts +13 -0
- package/packages/gantt/src/components/icon/icon.component.scss +13 -0
- package/packages/gantt/src/components/icon/icon.component.ts +28 -0
- package/packages/gantt/src/components/icon/icons.ts +86 -0
- package/packages/gantt/src/components/links/links.component.html +19 -0
- package/packages/gantt/src/components/links/links.component.scss +27 -0
- package/packages/gantt/src/components/links/links.component.ts +263 -0
- package/packages/gantt/src/components/main/gantt-main.component.html +35 -0
- package/packages/gantt/src/components/main/gantt-main.component.ts +35 -0
- package/packages/gantt/src/components/range/range.component.html +8 -0
- package/packages/gantt/src/components/range/range.component.scss +35 -0
- package/packages/gantt/src/components/range/range.component.ts +27 -0
- package/packages/gantt/src/components/range/test/range.component.spec.ts +80 -0
- package/packages/gantt/src/components/table/gantt-table.component.html +105 -0
- package/packages/gantt/src/components/table/gantt-table.component.scss +144 -0
- package/packages/gantt/src/components/table/gantt-table.component.ts +166 -0
- package/packages/gantt/src/components/table/test/table.spec.ts +129 -0
- package/packages/gantt/src/gantt-abstract.ts +14 -0
- package/packages/gantt/src/gantt-dom.service.ts +134 -0
- package/packages/gantt/src/gantt-drag-container.ts +73 -0
- package/packages/gantt/src/gantt-item-upper.ts +50 -0
- package/packages/gantt/src/gantt-print.service.ts +104 -0
- package/packages/gantt/src/gantt-upper.ts +289 -0
- package/packages/gantt/src/gantt.component.html +18 -0
- package/packages/gantt/src/gantt.component.scss +77 -0
- package/packages/gantt/src/gantt.component.ts +134 -0
- package/packages/gantt/src/gantt.module.ts +47 -0
- package/packages/gantt/src/gantt.pipe.ts +31 -0
- package/packages/gantt/src/gantt.styles.ts +28 -0
- package/{public-api.d.ts → packages/gantt/src/public-api.ts} +6 -0
- package/packages/gantt/src/root.component.html +12 -0
- package/packages/gantt/src/root.component.ts +121 -0
- package/packages/gantt/src/styles/index.scss +9 -0
- package/packages/gantt/src/styles/variables.scss +46 -0
- package/packages/gantt/src/table/gantt-column.component.ts +25 -0
- package/packages/gantt/src/table/gantt-table.component.ts +14 -0
- package/packages/gantt/src/table/test/table.spec.ts +56 -0
- package/packages/gantt/src/test/gantt.component.spec.ts +404 -0
- package/packages/gantt/src/test/mocks/data.ts +303 -0
- package/packages/gantt/src/test.ts +21 -0
- package/packages/gantt/src/utils/date.ts +276 -0
- package/packages/gantt/src/utils/helpers.ts +66 -0
- package/packages/gantt/src/utils/test/date.spec.ts +105 -0
- package/packages/gantt/src/utils/test/helpers.spec.ts +73 -0
- package/packages/gantt/src/utils/testing.ts +64 -0
- package/packages/gantt/src/views/day.ts +74 -0
- package/packages/gantt/src/views/factory.ts +25 -0
- package/packages/gantt/src/views/month.ts +66 -0
- package/packages/gantt/src/views/quarter.ts +68 -0
- package/packages/gantt/src/views/test/day.spec.ts +45 -0
- package/packages/gantt/src/views/test/factory.spec.ts +41 -0
- package/packages/gantt/src/views/test/mock.ts +14 -0
- package/packages/gantt/src/views/test/month.spec.ts +45 -0
- package/packages/gantt/src/views/test/quarter.spec.ts +45 -0
- package/packages/gantt/src/views/test/view.spec.ts +144 -0
- package/packages/gantt/src/views/test/week.spec.ts +45 -0
- package/packages/gantt/src/views/test/year.spec.ts +45 -0
- package/packages/gantt/src/views/view.ts +186 -0
- package/packages/gantt/src/views/week.ts +66 -0
- package/packages/gantt/src/views/year.ts +62 -0
- package/packages/gantt/tsconfig.lib.json +20 -0
- package/packages/gantt/tsconfig.lib.prod.json +9 -0
- package/packages/gantt/tsconfig.schematics.json +25 -0
- package/packages/gantt/tsconfig.spec.json +17 -0
- package/packages/gantt/tslint.json +18 -0
- package/scss-bundle.config.json +7 -0
- package/tsconfig.json +26 -0
- package/tslint.json +51 -0
- package/bundles/worktile-gantt.umd.js +0 -3128
- package/bundles/worktile-gantt.umd.js.map +0 -1
- package/class/date-point.d.ts +0 -15
- package/class/group.d.ts +0 -22
- package/class/item.d.ts +0 -70
- package/class/view-type.d.ts +0 -7
- package/components/bar/bar-drag.d.ts +0 -34
- package/components/bar/bar.component.d.ts +0 -23
- package/components/calendar/calendar.component.d.ts +0 -25
- package/components/drag-backdrop/drag-backdrop.component.d.ts +0 -6
- package/components/icon/icon.component.d.ts +0 -10
- package/components/icon/icons.d.ts +0 -8
- package/components/links/links.component.d.ts +0 -44
- package/components/main/gantt-main.component.d.ts +0 -18
- package/components/range/range.component.d.ts +0 -10
- package/components/table/gantt-table.component.d.ts +0 -31
- package/esm2015/class/date-point.js +0 -10
- package/esm2015/class/event.js +0 -13
- package/esm2015/class/group.js +0 -17
- package/esm2015/class/index.js +0 -6
- package/esm2015/class/item.js +0 -78
- package/esm2015/class/view-type.js +0 -9
- package/esm2015/components/bar/bar-drag.js +0 -266
- package/esm2015/components/bar/bar.component.js +0 -91
- package/esm2015/components/calendar/calendar.component.js +0 -82
- package/esm2015/components/drag-backdrop/drag-backdrop.component.js +0 -18
- package/esm2015/components/icon/icon.component.js +0 -36
- package/esm2015/components/icon/icons.js +0 -87
- package/esm2015/components/links/links.component.js +0 -207
- package/esm2015/components/main/gantt-main.component.js +0 -35
- package/esm2015/components/range/range.component.js +0 -32
- package/esm2015/components/table/gantt-table.component.js +0 -125
- package/esm2015/gantt-dom.service.js +0 -101
- package/esm2015/gantt-drag-container.js +0 -57
- package/esm2015/gantt-item-upper.js +0 -55
- package/esm2015/gantt-print.service.js +0 -92
- package/esm2015/gantt-upper.js +0 -231
- package/esm2015/gantt.component.js +0 -105
- package/esm2015/gantt.module.js +0 -43
- package/esm2015/gantt.pipe.js +0 -33
- package/esm2015/gantt.styles.js +0 -15
- package/esm2015/public-api.js +0 -16
- package/esm2015/root.component.js +0 -111
- package/esm2015/table/gantt-column.component.js +0 -28
- package/esm2015/table/gantt-table.component.js +0 -18
- package/esm2015/utils/date.js +0 -160
- package/esm2015/utils/helpers.js +0 -45
- package/esm2015/views/day.js +0 -54
- package/esm2015/views/factory.js +0 -23
- package/esm2015/views/month.js +0 -48
- package/esm2015/views/quarter.js +0 -51
- package/esm2015/views/view.js +0 -121
- package/esm2015/views/week.js +0 -49
- package/esm2015/views/year.js +0 -50
- package/esm2015/worktile-gantt.js +0 -16
- package/fesm2015/worktile-gantt.js +0 -2488
- package/fesm2015/worktile-gantt.js.map +0 -1
- package/gantt-dom.service.d.ts +0 -29
- package/gantt-drag-container.d.ts +0 -20
- package/gantt-item-upper.d.ts +0 -17
- package/gantt-print.service.d.ts +0 -10
- package/gantt-upper.d.ts +0 -62
- package/gantt.component.d.ts +0 -28
- package/gantt.module.d.ts +0 -2
- package/gantt.pipe.d.ts +0 -11
- package/gantt.styles.d.ts +0 -15
- package/main.bundle.scss +0 -645
- package/root.component.d.ts +0 -25
- package/table/gantt-column.component.d.ts +0 -12
- package/table/gantt-table.component.d.ts +0 -7
- package/utils/date.d.ts +0 -59
- package/utils/helpers.d.ts +0 -11
- package/views/day.d.ts +0 -14
- package/views/factory.d.ts +0 -8
- package/views/month.d.ts +0 -12
- package/views/quarter.d.ts +0 -12
- package/views/view.d.ts +0 -56
- package/views/week.d.ts +0 -12
- package/views/year.d.ts +0 -12
- package/worktile-gantt.d.ts +0 -15
- package/worktile-gantt.metadata.json +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<div style="line-height: 30px; padding: 15px; display: flex;">
|
|
2
|
+
<div style="flex: 1;">
|
|
3
|
+
<span class="text-primary">NgxGantt</span> 导出了 <span class="text-primary">ngx-gantt-root</span>、<span class="text-primary"
|
|
4
|
+
>ngx-gantt-bar</span
|
|
5
|
+
>
|
|
6
|
+
等基础组件,结合这些基础组件使用者可以结合自己的业务场景来封装自己的 Gantt 组件。
|
|
7
|
+
<br />
|
|
8
|
+
下面示例实现了任务分组的展示,并且将每个分组下任务按时间维度打平展示。
|
|
9
|
+
</div>
|
|
10
|
+
<div style="padding-right: 15px;">
|
|
11
|
+
<a href="https://github.com/worktile/ngx-gantt/blob/master/example/src/app/gantt-advanced" target="_blank">查看源码</a>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<thy-layout>
|
|
15
|
+
<thy-content>
|
|
16
|
+
<app-gantt-flat
|
|
17
|
+
#gantt
|
|
18
|
+
[items]="items"
|
|
19
|
+
[groups]="groups"
|
|
20
|
+
[viewType]="options.viewType"
|
|
21
|
+
[draggable]="options.draggable"
|
|
22
|
+
[styles]="options.styles"
|
|
23
|
+
>
|
|
24
|
+
<ng-template #group let-group="group">
|
|
25
|
+
{{ group.title }}
|
|
26
|
+
</ng-template>
|
|
27
|
+
<ng-template #bar let-item="item">
|
|
28
|
+
<span style="color: #fff"> {{ item.title }}</span>
|
|
29
|
+
</ng-template>
|
|
30
|
+
</app-gantt-flat>
|
|
31
|
+
</thy-content>
|
|
32
|
+
</thy-layout>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Component, OnInit, HostBinding } from '@angular/core';
|
|
2
|
+
import { GanttViewType, GanttGroup, GanttItem } from 'ngx-gantt';
|
|
3
|
+
import { randomGroupsAndItems } from '../helper';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-gantt-advanced-example',
|
|
7
|
+
templateUrl: './gantt-advanced.component.html'
|
|
8
|
+
})
|
|
9
|
+
export class AppGanttAdvancedExampleComponent implements OnInit {
|
|
10
|
+
constructor() {}
|
|
11
|
+
|
|
12
|
+
items: GanttItem[] = [];
|
|
13
|
+
|
|
14
|
+
groups: GanttGroup[] = [];
|
|
15
|
+
|
|
16
|
+
options = {
|
|
17
|
+
viewType: GanttViewType.month,
|
|
18
|
+
draggable: true,
|
|
19
|
+
mergeIntervalDays: 3,
|
|
20
|
+
styles: {
|
|
21
|
+
lineHeight: 50
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
@HostBinding('class.gantt-example-component') class = true;
|
|
26
|
+
|
|
27
|
+
ngOnInit(): void {
|
|
28
|
+
const { groups, items } = randomGroupsAndItems(10);
|
|
29
|
+
this.groups = groups;
|
|
30
|
+
this.items = items;
|
|
31
|
+
|
|
32
|
+
console.log(this.groups, this.items);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
export const mockGroups = [
|
|
2
|
+
{
|
|
3
|
+
id: '00001',
|
|
4
|
+
title: 'Project 1',
|
|
5
|
+
class: 'test'
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
id: '00002',
|
|
9
|
+
title: 'Project 2'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: '00003',
|
|
13
|
+
title: 'Project 3'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: '00004',
|
|
17
|
+
title: 'Project 4'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: '00005',
|
|
21
|
+
title: 'Project 5'
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export const mockItems = [
|
|
26
|
+
{
|
|
27
|
+
id: 'item-0101',
|
|
28
|
+
title: 'VERSION 0101',
|
|
29
|
+
start: 1601318400,
|
|
30
|
+
group_id: '00001',
|
|
31
|
+
color: '#FF0000',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'item-0102',
|
|
35
|
+
title: 'VERSION 0102',
|
|
36
|
+
start: 1590935675,
|
|
37
|
+
end: 1591318400,
|
|
38
|
+
color: '#9ACD32',
|
|
39
|
+
group_id: '00001',
|
|
40
|
+
expandable: true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'item-0103',
|
|
44
|
+
title: 'VERSION 0103',
|
|
45
|
+
end: 1590035000,
|
|
46
|
+
group_id: '00001'
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'item-0104',
|
|
50
|
+
title: 'VERSION 0104',
|
|
51
|
+
group_id: '00001',
|
|
52
|
+
links: ['item-0301']
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'item-0201',
|
|
56
|
+
title: 'VERSION 0201',
|
|
57
|
+
group_id: '00002'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'item-0202',
|
|
61
|
+
title: 'VERSION 0202',
|
|
62
|
+
start: 1581035675,
|
|
63
|
+
end: 1590230000,
|
|
64
|
+
group_id: '00002',
|
|
65
|
+
links: ['item-0203'],
|
|
66
|
+
color: 'rgb(52, 143, 228, 0.5)',
|
|
67
|
+
barStyle: {
|
|
68
|
+
border: '1px solid rgb(52, 143, 228)'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'item-0203',
|
|
73
|
+
title: 'VERSION 0203',
|
|
74
|
+
start: 1593548400,
|
|
75
|
+
end: 1602428400,
|
|
76
|
+
group_id: '00002',
|
|
77
|
+
links: ['item-0204']
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'item-0204',
|
|
81
|
+
title: 'VERSION 0204',
|
|
82
|
+
start: 1591035675,
|
|
83
|
+
end: 1592418400,
|
|
84
|
+
group_id: '00002',
|
|
85
|
+
links: ['item-0301', 'item-0402']
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
{
|
|
89
|
+
id: 'item-0301',
|
|
90
|
+
title: 'VERSION 0301',
|
|
91
|
+
start: 1596035675,
|
|
92
|
+
end: 1599018400,
|
|
93
|
+
group_id: '00003'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'item-0302',
|
|
97
|
+
title: 'VERSION 0302',
|
|
98
|
+
start: 1592035675,
|
|
99
|
+
end: 1598018400,
|
|
100
|
+
group_id: '00003'
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: 'item-0303',
|
|
104
|
+
title: 'VERSION 0303',
|
|
105
|
+
start: 1590135675,
|
|
106
|
+
end: 1594018400,
|
|
107
|
+
group_id: '00003'
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: 'item-0401',
|
|
111
|
+
title: 'VERSION 0401',
|
|
112
|
+
start: 1589035675,
|
|
113
|
+
end: 1594018400,
|
|
114
|
+
group_id: '00004'
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'item-0402',
|
|
118
|
+
title: 'VERSION 0402',
|
|
119
|
+
start: 1596035675,
|
|
120
|
+
end: 1599918400,
|
|
121
|
+
group_id: '00004'
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: 'item-0403',
|
|
125
|
+
title: 'VERSION 0403',
|
|
126
|
+
start: 1593035675,
|
|
127
|
+
end: 1599018400,
|
|
128
|
+
group_id: '00004'
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: 'item-0404',
|
|
132
|
+
title: 'VERSION 0404',
|
|
133
|
+
start: 1591035675,
|
|
134
|
+
end: 1592918400,
|
|
135
|
+
group_id: '00004'
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: 'item-0501',
|
|
139
|
+
title: 'VERSION 0501',
|
|
140
|
+
start: 1599935675,
|
|
141
|
+
end: 1602018400,
|
|
142
|
+
group_id: '00005'
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: 'item-0502',
|
|
146
|
+
title: 'VERSION 0502',
|
|
147
|
+
start: 1591035675,
|
|
148
|
+
end: 1594018400,
|
|
149
|
+
group_id: '00005'
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: 'item-0503',
|
|
153
|
+
title: 'VERSION 0503',
|
|
154
|
+
start: 1595035675,
|
|
155
|
+
end: 1599018400,
|
|
156
|
+
group_id: '00005'
|
|
157
|
+
}
|
|
158
|
+
];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<thy-layout>
|
|
2
|
+
<thy-header>
|
|
3
|
+
<ng-template #headerContent>
|
|
4
|
+
<thy-button-group thySize="sm" thyType="outline-default">
|
|
5
|
+
<button thyButton *ngFor="let view of views" [class.active]="view.value === viewType" (click)="viewType = view.value">
|
|
6
|
+
{{ view.name }}
|
|
7
|
+
</button>
|
|
8
|
+
</thy-button-group>
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<thy-button thyType="primary" thySize="sm" (click)="expandAllGroups()">
|
|
12
|
+
{{ expanded ? '折叠全部分组' : '展开全部分组' }}
|
|
13
|
+
</thy-button>
|
|
14
|
+
</ng-template>
|
|
15
|
+
<ng-template #headerOperation>
|
|
16
|
+
<a href="https://github.com/worktile/ngx-gantt/blob/master/example/src/app/gantt-groups" target="_blank">查看源码</a>
|
|
17
|
+
</ng-template>
|
|
18
|
+
</thy-header>
|
|
19
|
+
<thy-content>
|
|
20
|
+
<ngx-gantt #gantt [groups]="groups" [items]="items" [viewType]="viewType" [draggable]="true">
|
|
21
|
+
<ngx-gantt-table>
|
|
22
|
+
<ngx-gantt-column name="标题" width="180px">
|
|
23
|
+
<ng-template #cell let-item="item"> {{ item.title }} </ng-template>
|
|
24
|
+
</ngx-gantt-column>
|
|
25
|
+
<ngx-gantt-column name="开始时间" width="140px">
|
|
26
|
+
<ng-template #cell let-item="item">
|
|
27
|
+
{{ item.start * 1000 | date: 'yyyy-MM-dd' }}
|
|
28
|
+
</ng-template>
|
|
29
|
+
</ngx-gantt-column>
|
|
30
|
+
<ngx-gantt-column name="截止时间" width="140px">
|
|
31
|
+
<ng-template #cell let-item="item">
|
|
32
|
+
{{ item.end * 1000 | date: 'yyyy-MM-dd' }}
|
|
33
|
+
</ng-template>
|
|
34
|
+
</ngx-gantt-column>
|
|
35
|
+
</ngx-gantt-table>
|
|
36
|
+
<!-- group template -->
|
|
37
|
+
<ng-template #group let-group="group" let-items="items">
|
|
38
|
+
<span class="text-primary">{{ group.title }} 🚀 </span>
|
|
39
|
+
</ng-template>
|
|
40
|
+
</ngx-gantt>
|
|
41
|
+
</thy-content>
|
|
42
|
+
</thy-layout>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Component, OnInit, HostBinding, ViewChild } from '@angular/core';
|
|
2
|
+
import { GanttViewType, GanttItem, GanttGroup, NgxGanttComponent } from 'ngx-gantt';
|
|
3
|
+
import { randomGroupsAndItems } from '../helper';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-gantt-groups-example',
|
|
7
|
+
templateUrl: './gantt-groups.component.html'
|
|
8
|
+
})
|
|
9
|
+
export class AppGanttGroupsExampleComponent implements OnInit {
|
|
10
|
+
views = [
|
|
11
|
+
{
|
|
12
|
+
name: '日',
|
|
13
|
+
value: GanttViewType.day
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: '周',
|
|
17
|
+
value: GanttViewType.week
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: '月',
|
|
21
|
+
value: GanttViewType.month
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: '季',
|
|
25
|
+
value: GanttViewType.quarter
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: '年',
|
|
29
|
+
value: GanttViewType.year
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
viewType: GanttViewType = GanttViewType.quarter;
|
|
34
|
+
|
|
35
|
+
items: GanttItem[] = [];
|
|
36
|
+
|
|
37
|
+
groups: GanttGroup[] = [];
|
|
38
|
+
|
|
39
|
+
expanded = true;
|
|
40
|
+
|
|
41
|
+
@ViewChild('gantt') ganttComponent: NgxGanttComponent;
|
|
42
|
+
|
|
43
|
+
@HostBinding('class.gantt-example-component') class = true;
|
|
44
|
+
|
|
45
|
+
constructor() {}
|
|
46
|
+
|
|
47
|
+
ngOnInit(): void {
|
|
48
|
+
const { groups, items } = randomGroupsAndItems(10);
|
|
49
|
+
this.groups = groups;
|
|
50
|
+
this.items = items;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
expandAllGroups() {
|
|
54
|
+
if (this.expanded) {
|
|
55
|
+
this.expanded = false;
|
|
56
|
+
this.ganttComponent.collapseAll();
|
|
57
|
+
} else {
|
|
58
|
+
this.expanded = true;
|
|
59
|
+
this.ganttComponent.expandAll();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<div class="gantt-demo-header">
|
|
2
|
+
<div class="header-section">
|
|
3
|
+
<span class="header-section-title">视图:</span>
|
|
4
|
+
<span class="header-section-content">
|
|
5
|
+
<input id="day" type="radio" value="day" name="view-type" [(ngModel)]="options.viewType" /> <label for="day">日</label>
|
|
6
|
+
<input id="month" type="radio" value="month" name="view-type" [(ngModel)]="options.viewType" /> <label for="month">月</label>
|
|
7
|
+
<input id="quarter" type="radio" value="quarter" name="view-type" [(ngModel)]="options.viewType" /> <label for="quarter">季度</label>
|
|
8
|
+
</span>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="header-section">
|
|
11
|
+
<span class="header-section-title">是否可拖拽:</span>
|
|
12
|
+
<span class="header-section-content">
|
|
13
|
+
<input type="checkbox" [(ngModel)]="options.draggable" />
|
|
14
|
+
</span>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div class="header-section">
|
|
18
|
+
<span class="header-section-content">
|
|
19
|
+
<button (click)="gantt.expandAll()">全部展开</button>
|
|
20
|
+
</span>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="header-section">
|
|
23
|
+
<span class="header-section-content">
|
|
24
|
+
<button (click)="gantt.collapseAll()">全部收起</button>
|
|
25
|
+
</span>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="header-section">
|
|
28
|
+
<span class="header-section-content">
|
|
29
|
+
<button (click)="print('gantt-range')">导出为图片</button>
|
|
30
|
+
</span>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="gantt-demo-content">
|
|
34
|
+
<ngx-gantt
|
|
35
|
+
#gantt
|
|
36
|
+
start="1514736000"
|
|
37
|
+
end="1609430400"
|
|
38
|
+
[items]="items"
|
|
39
|
+
[viewType]="options.viewType"
|
|
40
|
+
[draggable]="options.draggable"
|
|
41
|
+
[async]="options.async"
|
|
42
|
+
[childrenResolve]="options.childrenResolve"
|
|
43
|
+
(barClick)="barClick($event)"
|
|
44
|
+
(dragEnded)="dragEnded($event)"
|
|
45
|
+
(loadOnScroll)="loadOnScroll($event)"
|
|
46
|
+
>
|
|
47
|
+
<ngx-gantt-table>
|
|
48
|
+
<ngx-gantt-column name="标题">
|
|
49
|
+
<ng-template #cell let-item="item">
|
|
50
|
+
{{ item.title }}
|
|
51
|
+
</ng-template>
|
|
52
|
+
</ngx-gantt-column>
|
|
53
|
+
<ngx-gantt-column>
|
|
54
|
+
<ng-template #header> <span style="font-weight: bold;">开始时间</span> </ng-template>
|
|
55
|
+
<ng-template #cell let-item="item">
|
|
56
|
+
{{ item.start * 1000 | date: 'yyyy-MM-dd' }}
|
|
57
|
+
</ng-template>
|
|
58
|
+
</ngx-gantt-column>
|
|
59
|
+
<ngx-gantt-column name="截止时间">
|
|
60
|
+
<ng-template #cell let-item="item">
|
|
61
|
+
{{ item.end * 1000 | date: 'yyyy-MM-dd' }}
|
|
62
|
+
</ng-template>
|
|
63
|
+
</ngx-gantt-column>
|
|
64
|
+
</ngx-gantt-table>
|
|
65
|
+
</ngx-gantt>
|
|
66
|
+
</div>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Component, OnInit, HostBinding } from '@angular/core';
|
|
2
|
+
import { mockItems } from './mocks';
|
|
3
|
+
import {
|
|
4
|
+
GanttBarClickEvent,
|
|
5
|
+
GanttViewType,
|
|
6
|
+
GanttDragEvent,
|
|
7
|
+
GanttLoadOnScrollEvent,
|
|
8
|
+
GanttLineClickEvent,
|
|
9
|
+
GanttLinkDragEvent,
|
|
10
|
+
GanttItem,
|
|
11
|
+
GanttViewOptions,
|
|
12
|
+
GanttDate,
|
|
13
|
+
GanttPrintService
|
|
14
|
+
} from 'ngx-gantt';
|
|
15
|
+
import { of } from 'rxjs';
|
|
16
|
+
import { delay } from 'rxjs/operators';
|
|
17
|
+
@Component({
|
|
18
|
+
selector: 'app-gantt-range-example',
|
|
19
|
+
templateUrl: './gantt-range.component.html',
|
|
20
|
+
providers: [GanttPrintService]
|
|
21
|
+
})
|
|
22
|
+
export class AppGanttRangeExampleComponent implements OnInit {
|
|
23
|
+
items = mockItems;
|
|
24
|
+
|
|
25
|
+
options = {
|
|
26
|
+
viewType: GanttViewType.month,
|
|
27
|
+
draggable: true,
|
|
28
|
+
async: true,
|
|
29
|
+
childrenResolve: this.getChildren.bind(this)
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
viewOptions: GanttViewOptions = {
|
|
33
|
+
start: new GanttDate(new Date('2020-3-1')),
|
|
34
|
+
end: new GanttDate(new Date('2020-6-30'))
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
@HostBinding('class.gantt-demo') class = true;
|
|
38
|
+
|
|
39
|
+
constructor(private printService: GanttPrintService) {}
|
|
40
|
+
|
|
41
|
+
ngOnInit(): void {}
|
|
42
|
+
|
|
43
|
+
barClick(event: GanttBarClickEvent) {
|
|
44
|
+
console.log(event);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
dragEnded(event: GanttDragEvent) {
|
|
48
|
+
this.items = [...this.items];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
loadOnScroll(event: GanttLoadOnScrollEvent) {}
|
|
52
|
+
|
|
53
|
+
getChildren(item: GanttItem) {
|
|
54
|
+
return of([
|
|
55
|
+
{
|
|
56
|
+
id: new Date().getTime(),
|
|
57
|
+
title: new Date().getTime(),
|
|
58
|
+
start: Math.floor(new Date().getTime() / 1000),
|
|
59
|
+
draggable: true,
|
|
60
|
+
linkable: false
|
|
61
|
+
}
|
|
62
|
+
]).pipe(delay(1000));
|
|
63
|
+
}
|
|
64
|
+
print(name: string) {
|
|
65
|
+
this.printService.print(name);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
export const mockItems = [
|
|
2
|
+
{
|
|
3
|
+
id: 'item-0101',
|
|
4
|
+
title: 'VERSION 0101',
|
|
5
|
+
start: 1590035675,
|
|
6
|
+
group_id: '00001',
|
|
7
|
+
color: '#FF0000',
|
|
8
|
+
type: 'range',
|
|
9
|
+
progress: 0.5,
|
|
10
|
+
children: [
|
|
11
|
+
{
|
|
12
|
+
id: 'item-child-0101',
|
|
13
|
+
title: 'VERSION Children 0101',
|
|
14
|
+
start: 1590035675,
|
|
15
|
+
group_id: '00001',
|
|
16
|
+
color: '#FF0000',
|
|
17
|
+
linkable: false,
|
|
18
|
+
progress: 0.5,
|
|
19
|
+
barStyle: { border: `1px solid #FF0000` }
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'item-0102',
|
|
25
|
+
title: 'VERSION 0102',
|
|
26
|
+
start: 1590935675,
|
|
27
|
+
end: 1591318400,
|
|
28
|
+
color: '#9ACD32',
|
|
29
|
+
group_id: '00001',
|
|
30
|
+
expandable: true
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 'item-0103',
|
|
34
|
+
title: 'VERSION 0103',
|
|
35
|
+
end: 1592018400,
|
|
36
|
+
group_id: '00001'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'item-0104',
|
|
40
|
+
title: 'VERSION 0104',
|
|
41
|
+
group_id: '00001',
|
|
42
|
+
links: ['item-0301']
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'item-0201',
|
|
46
|
+
title: 'VERSION 0201',
|
|
47
|
+
group_id: '00002'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'item-0202',
|
|
51
|
+
title: 'VERSION 0202',
|
|
52
|
+
start: 1591035675,
|
|
53
|
+
end: 1593018400,
|
|
54
|
+
group_id: '00002',
|
|
55
|
+
links: ['item-0203'],
|
|
56
|
+
color: 'rgb(52, 143, 228, 0.5)',
|
|
57
|
+
barStyle: {
|
|
58
|
+
border: '1px solid rgb(52, 143, 228)'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'item-0203',
|
|
63
|
+
title: 'VERSION 0203',
|
|
64
|
+
start: 1590235675,
|
|
65
|
+
end: 1591718400,
|
|
66
|
+
group_id: '00002',
|
|
67
|
+
links: ['item-0204'],
|
|
68
|
+
progress: 0.6,
|
|
69
|
+
barStyle: { border: `1px solid rgb(52, 143, 228)` }
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'item-0204',
|
|
73
|
+
title: 'VERSION 0204',
|
|
74
|
+
start: 1591035675,
|
|
75
|
+
end: 1592418400,
|
|
76
|
+
group_id: '00002',
|
|
77
|
+
links: ['item-0301', 'item-0402']
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
{
|
|
81
|
+
id: 'item-0301',
|
|
82
|
+
title: 'VERSION 0301',
|
|
83
|
+
start: 1596035675,
|
|
84
|
+
end: 1599018400,
|
|
85
|
+
group_id: '00003'
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: 'item-0302',
|
|
89
|
+
title: 'VERSION 0302',
|
|
90
|
+
start: 1592035675,
|
|
91
|
+
end: 1598018400,
|
|
92
|
+
group_id: '00003'
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: 'item-0303',
|
|
96
|
+
title: 'VERSION 0303',
|
|
97
|
+
start: 1590135675,
|
|
98
|
+
end: 1594018400,
|
|
99
|
+
group_id: '00003'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: 'item-0401',
|
|
103
|
+
title: 'VERSION 0401',
|
|
104
|
+
start: 1589035675,
|
|
105
|
+
end: 1594018400,
|
|
106
|
+
group_id: '00004'
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: 'item-0402',
|
|
110
|
+
title: 'VERSION 0402',
|
|
111
|
+
start: 1596035675,
|
|
112
|
+
end: 1599918400,
|
|
113
|
+
group_id: '00004'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: 'item-0403',
|
|
117
|
+
title: 'VERSION 0403',
|
|
118
|
+
start: 1593035675,
|
|
119
|
+
end: 1599018400,
|
|
120
|
+
group_id: '00004'
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: 'item-0404',
|
|
124
|
+
title: 'VERSION 0404',
|
|
125
|
+
start: 1591035675,
|
|
126
|
+
end: 1592918400,
|
|
127
|
+
group_id: '00004'
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: 'item-0501',
|
|
131
|
+
title: 'VERSION 0501',
|
|
132
|
+
start: 1599935675,
|
|
133
|
+
end: 1602018400,
|
|
134
|
+
group_id: '00005'
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: 'item-0502',
|
|
138
|
+
title: 'VERSION 0502',
|
|
139
|
+
start: 1591035675,
|
|
140
|
+
end: 1594018400,
|
|
141
|
+
group_id: '00005'
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: 'item-0503',
|
|
145
|
+
title: 'VERSION 0503',
|
|
146
|
+
start: 1595035675,
|
|
147
|
+
end: 1599018400,
|
|
148
|
+
group_id: '00005'
|
|
149
|
+
}
|
|
150
|
+
];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { addDays, getUnixTime } from 'date-fns';
|
|
2
|
+
import { GanttGroup, GanttItem } from 'ngx-gantt';
|
|
3
|
+
|
|
4
|
+
export function random(min: number, max: number) {
|
|
5
|
+
return Math.floor(Math.random() * (max - min)) + min;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function randomItems(length: number, parent?: GanttItem, group?: string) {
|
|
9
|
+
const items = [];
|
|
10
|
+
for (let i = 0; i < length; i++) {
|
|
11
|
+
const start = addDays(new Date(), random(-200, 200));
|
|
12
|
+
const end = addDays(start, random(0, 100));
|
|
13
|
+
items.push({
|
|
14
|
+
id: `${parent?.id || group || ''}00000${i}`,
|
|
15
|
+
title: `${parent?.title || 'Task'}-${i}`,
|
|
16
|
+
start: getUnixTime(start),
|
|
17
|
+
end: getUnixTime(end),
|
|
18
|
+
group_id: group
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return items;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function randomGroupsAndItems(length: number) {
|
|
25
|
+
const groups: GanttGroup[] = [];
|
|
26
|
+
let items: GanttItem[] = [];
|
|
27
|
+
for (let i = 0; i < length; i++) {
|
|
28
|
+
groups.push({
|
|
29
|
+
id: `00000${i}`,
|
|
30
|
+
title: `Group-${i}`
|
|
31
|
+
});
|
|
32
|
+
items = [...items, ...randomItems(6, undefined, groups[i].id)];
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
groups,
|
|
36
|
+
items
|
|
37
|
+
};
|
|
38
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// This file can be replaced during build by using the `fileReplacements` array.
|
|
2
|
+
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
|
|
3
|
+
// The list of file replacements can be found in `angular.json`.
|
|
4
|
+
|
|
5
|
+
export const environment = {
|
|
6
|
+
production: false
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* For easier debugging in development mode, you can import the following file
|
|
11
|
+
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
|
12
|
+
*
|
|
13
|
+
* This import should be commented out in production mode because it will have a negative impact
|
|
14
|
+
* on performance if an error is thrown.
|
|
15
|
+
*/
|
|
16
|
+
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
|
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>NgxGantt - Gantt Component for Angular</title>
|
|
6
|
+
<base href="/">
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<example-root></example-root>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|