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