@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.
Files changed (230) hide show
  1. package/README.md +13 -116
  2. package/bundles/worktile-gantt.umd.js +3303 -0
  3. package/bundles/worktile-gantt.umd.js.map +1 -0
  4. package/class/date-point.d.ts +15 -0
  5. package/{packages/gantt/src/class/event.ts → class/event.d.ts} +6 -12
  6. package/class/group.d.ts +22 -0
  7. package/{packages/gantt/src/class/index.ts → class/index.d.ts} +0 -0
  8. package/class/item.d.ts +70 -0
  9. package/class/view-type.d.ts +7 -0
  10. package/components/bar/bar-drag.d.ts +37 -0
  11. package/components/bar/bar.component.d.ts +26 -0
  12. package/components/calendar/calendar.component.d.ts +28 -0
  13. package/components/drag-backdrop/drag-backdrop.component.d.ts +9 -0
  14. package/components/icon/icon.component.d.ts +13 -0
  15. package/components/icon/icons.d.ts +8 -0
  16. package/components/links/links.component.d.ts +47 -0
  17. package/components/main/gantt-main.component.d.ts +21 -0
  18. package/components/range/range.component.d.ts +13 -0
  19. package/components/table/gantt-table.component.d.ts +36 -0
  20. package/esm2015/class/date-point.js +10 -0
  21. package/esm2015/class/event.js +13 -0
  22. package/esm2015/class/group.js +17 -0
  23. package/esm2015/class/index.js +6 -0
  24. package/esm2015/class/item.js +78 -0
  25. package/esm2015/class/view-type.js +9 -0
  26. package/esm2015/components/bar/bar-drag.js +264 -0
  27. package/esm2015/components/bar/bar.component.js +98 -0
  28. package/esm2015/components/calendar/calendar.component.js +86 -0
  29. package/esm2015/components/drag-backdrop/drag-backdrop.component.js +21 -0
  30. package/esm2015/components/icon/icon.component.js +38 -0
  31. package/esm2015/components/icon/icons.js +87 -0
  32. package/esm2015/components/links/links.component.js +213 -0
  33. package/esm2015/components/main/gantt-main.component.js +53 -0
  34. package/esm2015/components/range/range.component.js +37 -0
  35. package/esm2015/components/table/gantt-table.component.js +146 -0
  36. package/esm2015/gantt-abstract.js +3 -0
  37. package/esm2015/gantt-dom.service.js +103 -0
  38. package/esm2015/gantt-drag-container.js +59 -0
  39. package/esm2015/gantt-item-upper.js +58 -0
  40. package/esm2015/gantt-print.service.js +94 -0
  41. package/esm2015/gantt-upper.js +254 -0
  42. package/esm2015/gantt.component.js +131 -0
  43. package/esm2015/gantt.module.js +74 -0
  44. package/esm2015/gantt.pipe.js +43 -0
  45. package/esm2015/gantt.styles.js +15 -0
  46. package/esm2015/public-api.js +18 -0
  47. package/esm2015/root.component.js +123 -0
  48. package/esm2015/table/gantt-column.component.js +37 -0
  49. package/esm2015/table/gantt-table.component.js +20 -0
  50. package/esm2015/utils/date.js +160 -0
  51. package/esm2015/utils/helpers.js +55 -0
  52. package/esm2015/views/day.js +54 -0
  53. package/esm2015/views/factory.js +23 -0
  54. package/esm2015/views/month.js +48 -0
  55. package/esm2015/views/quarter.js +51 -0
  56. package/esm2015/views/view.js +121 -0
  57. package/esm2015/views/week.js +49 -0
  58. package/esm2015/views/year.js +50 -0
  59. package/esm2015/worktile-gantt.js +5 -0
  60. package/fesm2015/worktile-gantt.js +2637 -0
  61. package/fesm2015/worktile-gantt.js.map +1 -0
  62. package/{packages/gantt/src/gantt-abstract.ts → gantt-abstract.d.ts} +1 -3
  63. package/gantt-dom.service.d.ts +32 -0
  64. package/gantt-drag-container.d.ts +23 -0
  65. package/gantt-item-upper.d.ts +20 -0
  66. package/gantt-print.service.d.ts +13 -0
  67. package/gantt-upper.d.ts +64 -0
  68. package/gantt.component.d.ts +29 -0
  69. package/gantt.module.d.ts +21 -0
  70. package/gantt.pipe.d.ts +18 -0
  71. package/gantt.styles.d.ts +15 -0
  72. package/main.bundle.scss +645 -0
  73. package/package.json +16 -113
  74. package/{packages/gantt/src/public-api.ts → public-api.d.ts} +0 -4
  75. package/root.component.d.ts +28 -0
  76. package/table/gantt-column.component.d.ts +15 -0
  77. package/table/gantt-table.component.d.ts +10 -0
  78. package/utils/date.d.ts +59 -0
  79. package/utils/helpers.d.ts +12 -0
  80. package/views/day.d.ts +14 -0
  81. package/views/factory.d.ts +8 -0
  82. package/views/month.d.ts +12 -0
  83. package/views/quarter.d.ts +12 -0
  84. package/views/view.d.ts +56 -0
  85. package/views/week.d.ts +12 -0
  86. package/views/year.d.ts +12 -0
  87. package/worktile-gantt.d.ts +5 -0
  88. package/.all-contributorsrc +0 -53
  89. package/.angulardoc.json +0 -4
  90. package/.circleci/config.yml +0 -17
  91. package/.coveralls.yml +0 -1
  92. package/.docgenirc.js +0 -64
  93. package/.editorconfig +0 -22
  94. package/.prettierrc +0 -24
  95. package/.travis.yml +0 -23
  96. package/CHANGELOG.md +0 -564
  97. package/Dockerfile +0 -4
  98. package/LICENSE +0 -21
  99. package/angular.json +0 -136
  100. package/docs/guides/basic/components.md +0 -54
  101. package/docs/guides/basic/event.md +0 -70
  102. package/docs/guides/basic/index.md +0 -4
  103. package/docs/guides/basic/style.md +0 -68
  104. package/docs/guides/basic/type.md +0 -70
  105. package/docs/guides/basic/usage.md +0 -189
  106. package/docs/guides/index.md +0 -5
  107. package/docs/guides/intro/getting-started.md +0 -79
  108. package/docs/guides/intro/index.md +0 -51
  109. package/docs/index.md +0 -0
  110. package/example/browserslist +0 -12
  111. package/example/src/app/app-routing.module.ts +0 -26
  112. package/example/src/app/app.component.html +0 -2
  113. package/example/src/app/app.component.ts +0 -11
  114. package/example/src/app/app.module.ts +0 -57
  115. package/example/src/app/components/components.component.html +0 -6
  116. package/example/src/app/components/components.component.ts +0 -33
  117. package/example/src/app/configuration/parameters/api/zh-cn.js +0 -350
  118. package/example/src/app/configuration/parameters/doc/zh-cn.md +0 -5
  119. package/example/src/app/gantt/gantt.component.html +0 -51
  120. package/example/src/app/gantt/gantt.component.ts +0 -119
  121. package/example/src/app/gantt-advanced/component/flat.component.html +0 -30
  122. package/example/src/app/gantt-advanced/component/flat.component.ts +0 -72
  123. package/example/src/app/gantt-advanced/component/flat.scss +0 -31
  124. package/example/src/app/gantt-advanced/gantt-advanced.component.html +0 -32
  125. package/example/src/app/gantt-advanced/gantt-advanced.component.ts +0 -34
  126. package/example/src/app/gantt-advanced/mocks.ts +0 -158
  127. package/example/src/app/gantt-groups/gantt-groups.component.html +0 -42
  128. package/example/src/app/gantt-groups/gantt-groups.component.ts +0 -62
  129. package/example/src/app/gantt-range/gantt-range.component.html +0 -66
  130. package/example/src/app/gantt-range/gantt-range.component.ts +0 -67
  131. package/example/src/app/gantt-range/mocks.ts +0 -150
  132. package/example/src/app/helper.ts +0 -38
  133. package/example/src/assets/.gitkeep +0 -0
  134. package/example/src/environments/environment.prod.ts +0 -3
  135. package/example/src/environments/environment.ts +0 -16
  136. package/example/src/favicon.ico +0 -0
  137. package/example/src/index.html +0 -13
  138. package/example/src/main.ts +0 -12
  139. package/example/src/polyfills.ts +0 -63
  140. package/example/src/styles.scss +0 -56
  141. package/example/tsconfig.app.json +0 -18
  142. package/nginx.conf +0 -17
  143. package/packages/gantt/README.md +0 -24
  144. package/packages/gantt/karma.conf.js +0 -46
  145. package/packages/gantt/ng-package.json +0 -7
  146. package/packages/gantt/ng-package.prod.json +0 -7
  147. package/packages/gantt/package.json +0 -16
  148. package/packages/gantt/src/class/date-point.ts +0 -14
  149. package/packages/gantt/src/class/group.ts +0 -36
  150. package/packages/gantt/src/class/item.ts +0 -129
  151. package/packages/gantt/src/class/test/group.spec.ts +0 -21
  152. package/packages/gantt/src/class/test/item.spec.ts +0 -102
  153. package/packages/gantt/src/class/view-type.ts +0 -7
  154. package/packages/gantt/src/components/bar/bar-drag.ts +0 -298
  155. package/packages/gantt/src/components/bar/bar.component.html +0 -17
  156. package/packages/gantt/src/components/bar/bar.component.scss +0 -169
  157. package/packages/gantt/src/components/bar/bar.component.ts +0 -109
  158. package/packages/gantt/src/components/bar/test/bar.component.spec.ts +0 -54
  159. package/packages/gantt/src/components/bar/test/bar.drag.spec.ts +0 -196
  160. package/packages/gantt/src/components/calendar/calendar.component.html +0 -52
  161. package/packages/gantt/src/components/calendar/calendar.component.scss +0 -77
  162. package/packages/gantt/src/components/calendar/calendar.component.ts +0 -100
  163. package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.html +0 -6
  164. package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.scss +0 -48
  165. package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.ts +0 -13
  166. package/packages/gantt/src/components/icon/icon.component.scss +0 -13
  167. package/packages/gantt/src/components/icon/icon.component.ts +0 -28
  168. package/packages/gantt/src/components/icon/icons.ts +0 -86
  169. package/packages/gantt/src/components/links/links.component.html +0 -19
  170. package/packages/gantt/src/components/links/links.component.scss +0 -27
  171. package/packages/gantt/src/components/links/links.component.ts +0 -263
  172. package/packages/gantt/src/components/main/gantt-main.component.html +0 -35
  173. package/packages/gantt/src/components/main/gantt-main.component.ts +0 -35
  174. package/packages/gantt/src/components/range/range.component.html +0 -8
  175. package/packages/gantt/src/components/range/range.component.scss +0 -35
  176. package/packages/gantt/src/components/range/range.component.ts +0 -27
  177. package/packages/gantt/src/components/range/test/range.component.spec.ts +0 -80
  178. package/packages/gantt/src/components/table/gantt-table.component.html +0 -105
  179. package/packages/gantt/src/components/table/gantt-table.component.scss +0 -144
  180. package/packages/gantt/src/components/table/gantt-table.component.ts +0 -166
  181. package/packages/gantt/src/components/table/test/table.spec.ts +0 -129
  182. package/packages/gantt/src/gantt-dom.service.ts +0 -134
  183. package/packages/gantt/src/gantt-drag-container.ts +0 -73
  184. package/packages/gantt/src/gantt-item-upper.ts +0 -50
  185. package/packages/gantt/src/gantt-print.service.ts +0 -104
  186. package/packages/gantt/src/gantt-upper.ts +0 -289
  187. package/packages/gantt/src/gantt.component.html +0 -18
  188. package/packages/gantt/src/gantt.component.scss +0 -77
  189. package/packages/gantt/src/gantt.component.ts +0 -134
  190. package/packages/gantt/src/gantt.module.ts +0 -47
  191. package/packages/gantt/src/gantt.pipe.ts +0 -31
  192. package/packages/gantt/src/gantt.styles.ts +0 -28
  193. package/packages/gantt/src/root.component.html +0 -12
  194. package/packages/gantt/src/root.component.ts +0 -121
  195. package/packages/gantt/src/styles/index.scss +0 -9
  196. package/packages/gantt/src/styles/variables.scss +0 -46
  197. package/packages/gantt/src/table/gantt-column.component.ts +0 -25
  198. package/packages/gantt/src/table/gantt-table.component.ts +0 -14
  199. package/packages/gantt/src/table/test/table.spec.ts +0 -56
  200. package/packages/gantt/src/test/gantt.component.spec.ts +0 -404
  201. package/packages/gantt/src/test/mocks/data.ts +0 -303
  202. package/packages/gantt/src/test.ts +0 -21
  203. package/packages/gantt/src/utils/date.ts +0 -276
  204. package/packages/gantt/src/utils/helpers.ts +0 -66
  205. package/packages/gantt/src/utils/test/date.spec.ts +0 -105
  206. package/packages/gantt/src/utils/test/helpers.spec.ts +0 -73
  207. package/packages/gantt/src/utils/testing.ts +0 -64
  208. package/packages/gantt/src/views/day.ts +0 -74
  209. package/packages/gantt/src/views/factory.ts +0 -25
  210. package/packages/gantt/src/views/month.ts +0 -66
  211. package/packages/gantt/src/views/quarter.ts +0 -68
  212. package/packages/gantt/src/views/test/day.spec.ts +0 -45
  213. package/packages/gantt/src/views/test/factory.spec.ts +0 -41
  214. package/packages/gantt/src/views/test/mock.ts +0 -14
  215. package/packages/gantt/src/views/test/month.spec.ts +0 -45
  216. package/packages/gantt/src/views/test/quarter.spec.ts +0 -45
  217. package/packages/gantt/src/views/test/view.spec.ts +0 -144
  218. package/packages/gantt/src/views/test/week.spec.ts +0 -45
  219. package/packages/gantt/src/views/test/year.spec.ts +0 -45
  220. package/packages/gantt/src/views/view.ts +0 -186
  221. package/packages/gantt/src/views/week.ts +0 -66
  222. package/packages/gantt/src/views/year.ts +0 -62
  223. package/packages/gantt/tsconfig.lib.json +0 -20
  224. package/packages/gantt/tsconfig.lib.prod.json +0 -9
  225. package/packages/gantt/tsconfig.schematics.json +0 -25
  226. package/packages/gantt/tsconfig.spec.json +0 -17
  227. package/packages/gantt/tslint.json +0 -18
  228. package/scss-bundle.config.json +0 -7
  229. package/tsconfig.json +0 -26
  230. package/tslint.json +0 -51
@@ -1,119 +0,0 @@
1
- import { GanttPrintService } from './../../../../packages/gantt/src/gantt-print.service';
2
- import { Component, OnInit, HostBinding } from '@angular/core';
3
- import {
4
- GanttBarClickEvent,
5
- GanttViewType,
6
- GanttDragEvent,
7
- GanttLoadOnScrollEvent,
8
- GanttLineClickEvent,
9
- GanttLinkDragEvent,
10
- GanttItem,
11
- GanttViewOptions,
12
- GanttDate
13
- } from 'ngx-gantt';
14
- import { of } from 'rxjs';
15
- import { delay } from 'rxjs/operators';
16
- import { ThyNotifyService } from 'ngx-tethys/notify';
17
- import { randomItems, random } from '../helper';
18
-
19
- @Component({
20
- selector: 'app-gantt-example',
21
- templateUrl: './gantt.component.html',
22
- providers: [GanttPrintService]
23
- })
24
- export class AppGanttExampleComponent implements OnInit {
25
- views = [
26
- {
27
- name: '日',
28
- value: GanttViewType.day
29
- },
30
- {
31
- name: '周',
32
- value: GanttViewType.week
33
- },
34
- {
35
- name: '月',
36
- value: GanttViewType.month
37
- },
38
- {
39
- name: '季',
40
- value: GanttViewType.quarter
41
- },
42
- {
43
- name: '年',
44
- value: GanttViewType.year
45
- }
46
- ];
47
-
48
- viewType: GanttViewType = GanttViewType.month;
49
-
50
- items: GanttItem[] = [
51
- { id: '000000', title: 'Task 0', start: 1627729997, end: 1628421197, expandable: true },
52
- { id: '000001', title: 'Task 1', start: 1617361997, end: 1625483597, links: ['000003', '000004', '000000'], expandable: true },
53
- { id: '000002', title: 'Task 2', start: 1610536397, end: 1610622797 },
54
- { id: '000003', title: 'Task 3', start: 1628507597, end: 1633345997, expandable: true },
55
- { id: '000004', title: 'Task 4', start: 1624705997, expandable: true },
56
- { id: '000005', title: 'Task 5', start: 1628075597, end: 1629544397, color: '#709dc1' },
57
- { id: '000006', title: 'Task 6', start: 1641121997, end: 1645528397 },
58
- { id: '000007', title: 'Task 7', start: 1639393997, end: 1640862797 },
59
- { id: '000008', title: 'Task 8', end: 1628783999, color:'#709dc1' },
60
- { id: '000009', title: 'Task 9', start: 1639307597, end: 1640344397 },
61
- { id: '0000010', title: 'Task 10', start: 1609067597, end: 1617275597 },
62
- { id: '0000011', title: 'Task 11', start: 1611918797, end: 1611918797 },
63
- { id: '0000012', title: 'Task 12', start: 1627816397, end: 1631358797 },
64
- { id: '0000013', title: 'Task 13', start: 1625051597, end: 1630667597, links: ['0000012'] },
65
- { id: '0000014', title: 'Task 14', start: 1627920000, end: 1629129599 },
66
- { id: '0000015', title: 'Task 15', start: 1633259597, end: 1639480397 },
67
- { id: '0000016', title: 'Task 16', start: 1624965197, end: 1627211597 },
68
- { id: '0000017', title: 'Task 17', start: 1641035597, end: 1649157197 },
69
- { id: '0000018', title: 'Task 18', start: 1637061197, end: 1642677197 },
70
- { id: '0000019', title: 'Task 19', start: 1637925197, end: 1646305997 },
71
- { id: '0000020', title: 'Task 20', start: 1628334797, end: 1629889997 },
72
- { id: '0000021', title: 'Task 21', start: 1622891597, end: 1627643597 },
73
- { id: '0000022', title: 'Task 22', start: 1616238797, end: 1620731597 },
74
- { id: '0000023', title: 'Task 23', start: 1626693197, end: 1630149197 },
75
- { id: '0000024', title: 'Task 24', start: 1626174797, end: 1626952397 },
76
- { id: '0000025', title: 'Task 25', start: 1631013197, end: 1637493197 },
77
- { id: '0000026', title: 'Task 26', start: 1635937997, end: 1643886797 },
78
- { id: '0000027', title: 'Task 27', start: 1637665997, end: 1644059597 },
79
- { id: '0000028', title: 'Task 28', start: 1611400397, end: 1615547597 },
80
- { id: '0000029', title: 'Task 29', start: 1618053197, end: 1619176397 }
81
- ];
82
-
83
- options = {
84
- viewType: GanttViewType.day
85
- };
86
-
87
- @HostBinding('class.gantt-example-component') class = true;
88
-
89
- childrenResolve = (item: GanttItem) => {
90
- const children = randomItems(random(1, 5), item);
91
- return of(children).pipe(delay(1000));
92
- };
93
-
94
- constructor(private printService: GanttPrintService, private thyNotify: ThyNotifyService) {}
95
-
96
- ngOnInit(): void {}
97
-
98
- barClick(event: GanttBarClickEvent) {
99
- this.thyNotify.info('Event: barClick', `你点击了 [${event.item.title}]`);
100
- }
101
-
102
- lineClick(event: GanttLineClickEvent) {
103
- this.thyNotify.info('Event: lineClick', `你点击了 ${event.source.title} 到 ${event.target.title} 的关联线`);
104
- }
105
-
106
- dragEnded(event: GanttDragEvent) {
107
- this.thyNotify.info('Event: dragEnded', `修改了 [${event.item.title}] 的时间`);
108
- this.items = [...this.items];
109
- }
110
-
111
- linkDragEnded(event: GanttLinkDragEvent) {
112
- this.items = [...this.items];
113
- this.thyNotify.info('Event: linkDragEnded', `创建了关联关系`);
114
- }
115
-
116
- print(name: string) {
117
- this.printService.print(name);
118
- }
119
- }
@@ -1,30 +0,0 @@
1
- <ngx-gantt-root [sideWidth]="300">
2
- <ng-template #sideTemplate>
3
- <div class="gantt-flat-side-header">项目</div>
4
- <div class="gantt-flat-side-body">
5
- <div class="gantt-group" *ngFor="let group of groups; trackBy: trackBy">
6
- <div class="gantt-group-content" [style.height.px]="group.mergedItems?.length * (styles.lineHeight + 10) - 10">
7
- {{ group.title }}
8
- </div>
9
- </div>
10
- </div>
11
- </ng-template>
12
- <ng-template #mainTemplate>
13
- <div class="gantt-main-container">
14
- <!-- groups -->
15
- <div class="gantt-main-groups" *ngIf="groups && groups.length > 0" [style.width.px]="view.width">
16
- <ng-container *ngFor="let group of groups; trackBy: trackBy">
17
- <div class="gantt-main-group" [style.height.px]="group.mergedItems?.length * (styles.lineHeight + 10) - 10">
18
- <ng-container *ngFor="let items of group.mergedItems">
19
- <div class="gantt-flat-items" [style.height.px]="styles.lineHeight">
20
- <ng-container *ngFor="let item of items; trackBy: trackBy">
21
- <ngx-gantt-bar [item]="item" [template]="barTemplate" (barClick)="barClick.emit($event)"></ngx-gantt-bar>
22
- </ng-container>
23
- </div>
24
- </ng-container>
25
- </div>
26
- </ng-container>
27
- </div>
28
- </div>
29
- </ng-template>
30
- </ngx-gantt-root>
@@ -1,72 +0,0 @@
1
- import { Component, OnInit, HostBinding, OnChanges, OnDestroy, SimpleChanges, NgZone, ChangeDetectorRef, ElementRef } from '@angular/core';
2
- import { GANTT_UPPER_TOKEN, GanttUpper, GanttItemInternal, GanttGroupInternal } from 'ngx-gantt';
3
- import { startWith, takeUntil } from 'rxjs/operators';
4
-
5
- @Component({
6
- selector: 'app-gantt-flat',
7
- templateUrl: './flat.component.html',
8
- styleUrls: ['./flat.scss'],
9
- providers: [
10
- {
11
- provide: GANTT_UPPER_TOKEN,
12
- useExisting: AppGanttFlatComponent
13
- }
14
- ]
15
- })
16
- export class AppGanttFlatComponent extends GanttUpper implements OnInit, OnChanges, OnDestroy {
17
- mergeIntervalDays = 3;
18
-
19
- groups: GanttGroupInternal[] = [];
20
-
21
- @HostBinding('class.gantt-flat') ganttFlatClass = true;
22
-
23
- constructor(elementRef: ElementRef<HTMLElement>, cdr: ChangeDetectorRef, ngZone: NgZone) {
24
- super(elementRef, cdr, ngZone);
25
- }
26
-
27
- private buildGroupMergedItems(items: GanttItemInternal[]) {
28
- const mergedItems: GanttItemInternal[][] = [];
29
- items = items.filter((item) => item.start && item.end).sort((a, b) => a.start.getUnixTime() - b.start.getUnixTime());
30
- items.forEach((item) => {
31
- let indexOfMergedItems = -1;
32
- for (let i = 0; i < mergedItems.length; i++) {
33
- const subItems = mergedItems[i];
34
- if (item.start.value > subItems[subItems.length - 1].end.addDays(this.mergeIntervalDays).value) {
35
- subItems.push(item);
36
- indexOfMergedItems = i;
37
- break;
38
- }
39
- }
40
- // 如果没有合适的位置插入,则插入到最后一行
41
- if (indexOfMergedItems === -1) {
42
- mergedItems.push([item]);
43
- indexOfMergedItems = mergedItems.length - 1;
44
- }
45
- });
46
- return mergedItems;
47
- }
48
-
49
- ngOnInit() {
50
- super.onInit();
51
- this.dragEnded.pipe(startWith(null), takeUntil(this.unsubscribe$)).subscribe(() => {
52
- this.buildGroupItems();
53
- });
54
- }
55
-
56
- private buildGroupItems() {
57
- console.log(this.groups);
58
- this.groups.forEach((group) => {
59
- group.mergedItems = this.buildGroupMergedItems(group.items);
60
- // 如果没有数据,默认填充两行空行
61
- group.mergedItems = group.mergedItems.length === 0 ? [[]] : group.mergedItems;
62
- });
63
- }
64
-
65
- ngOnChanges(changes: SimpleChanges) {
66
- super.onChanges(changes);
67
- }
68
-
69
- ngOnDestroy() {
70
- super.onDestroy();
71
- }
72
- }
@@ -1,31 +0,0 @@
1
- :host {
2
- .gantt-flat-side-header {
3
- text-align: center;
4
- position: sticky;
5
- top: 0;
6
- background: #fff;
7
- height: 44px;
8
- line-height: 44px;
9
- z-index: 1;
10
- border-bottom: 1px solid #eee;
11
- box-sizing: border-box;
12
- }
13
-
14
- .gantt-group {
15
- .gantt-group-content {
16
- border-bottom: 1px solid #eee;
17
- display: flex;
18
- align-items: center;
19
- padding: 15px;
20
- }
21
- }
22
-
23
- .gantt-main-group {
24
- border-bottom: 1px solid #eee;
25
- padding: 15px 0;
26
-
27
- .gantt-flat-items {
28
- position: relative;
29
- }
30
- }
31
- }
@@ -1,32 +0,0 @@
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">&nbsp;&nbsp;{{ item.title }}</span>
29
- </ng-template>
30
- </app-gantt-flat>
31
- </thy-content>
32
- </thy-layout>
@@ -1,34 +0,0 @@
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
- }
@@ -1,158 +0,0 @@
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
- ];
@@ -1,42 +0,0 @@
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
- &nbsp; &nbsp; &nbsp;
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>
@@ -1,62 +0,0 @@
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
- }
@@ -1,66 +0,0 @@
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>