@worktile/gantt 11.0.2 → 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.
Files changed (232) hide show
  1. package/.all-contributorsrc +53 -0
  2. package/.angulardoc.json +4 -0
  3. package/.circleci/config.yml +17 -0
  4. package/.coveralls.yml +1 -0
  5. package/.docgenirc.js +64 -0
  6. package/.editorconfig +22 -0
  7. package/.prettierrc +24 -0
  8. package/.travis.yml +23 -0
  9. package/CHANGELOG.md +564 -0
  10. package/Dockerfile +4 -0
  11. package/LICENSE +21 -0
  12. package/README.md +116 -13
  13. package/angular.json +136 -0
  14. package/docs/guides/basic/components.md +54 -0
  15. package/docs/guides/basic/event.md +70 -0
  16. package/docs/guides/basic/index.md +4 -0
  17. package/docs/guides/basic/style.md +68 -0
  18. package/docs/guides/basic/type.md +70 -0
  19. package/docs/guides/basic/usage.md +189 -0
  20. package/docs/guides/index.md +5 -0
  21. package/docs/guides/intro/getting-started.md +79 -0
  22. package/docs/guides/intro/index.md +51 -0
  23. package/docs/index.md +0 -0
  24. package/example/browserslist +12 -0
  25. package/example/src/app/app-routing.module.ts +26 -0
  26. package/example/src/app/app.component.html +2 -0
  27. package/example/src/app/app.component.ts +11 -0
  28. package/example/src/app/app.module.ts +57 -0
  29. package/example/src/app/components/components.component.html +6 -0
  30. package/example/src/app/components/components.component.ts +33 -0
  31. package/example/src/app/configuration/parameters/api/zh-cn.js +350 -0
  32. package/example/src/app/configuration/parameters/doc/zh-cn.md +5 -0
  33. package/example/src/app/gantt/gantt.component.html +51 -0
  34. package/example/src/app/gantt/gantt.component.ts +119 -0
  35. package/example/src/app/gantt-advanced/component/flat.component.html +30 -0
  36. package/example/src/app/gantt-advanced/component/flat.component.ts +72 -0
  37. package/example/src/app/gantt-advanced/component/flat.scss +31 -0
  38. package/example/src/app/gantt-advanced/gantt-advanced.component.html +32 -0
  39. package/example/src/app/gantt-advanced/gantt-advanced.component.ts +34 -0
  40. package/example/src/app/gantt-advanced/mocks.ts +158 -0
  41. package/example/src/app/gantt-groups/gantt-groups.component.html +42 -0
  42. package/example/src/app/gantt-groups/gantt-groups.component.ts +62 -0
  43. package/example/src/app/gantt-range/gantt-range.component.html +66 -0
  44. package/example/src/app/gantt-range/gantt-range.component.ts +67 -0
  45. package/example/src/app/gantt-range/mocks.ts +150 -0
  46. package/example/src/app/helper.ts +38 -0
  47. package/example/src/assets/.gitkeep +0 -0
  48. package/example/src/environments/environment.prod.ts +3 -0
  49. package/example/src/environments/environment.ts +16 -0
  50. package/example/src/favicon.ico +0 -0
  51. package/example/src/index.html +13 -0
  52. package/example/src/main.ts +12 -0
  53. package/example/src/polyfills.ts +63 -0
  54. package/example/src/styles.scss +56 -0
  55. package/example/tsconfig.app.json +18 -0
  56. package/nginx.conf +17 -0
  57. package/package.json +113 -17
  58. package/packages/gantt/README.md +24 -0
  59. package/packages/gantt/karma.conf.js +46 -0
  60. package/packages/gantt/ng-package.json +7 -0
  61. package/packages/gantt/ng-package.prod.json +7 -0
  62. package/packages/gantt/package.json +16 -0
  63. package/packages/gantt/src/class/date-point.ts +14 -0
  64. package/{class/event.d.ts → packages/gantt/src/class/event.ts} +12 -6
  65. package/packages/gantt/src/class/group.ts +36 -0
  66. package/{class/index.d.ts → packages/gantt/src/class/index.ts} +0 -0
  67. package/packages/gantt/src/class/item.ts +129 -0
  68. package/packages/gantt/src/class/test/group.spec.ts +21 -0
  69. package/packages/gantt/src/class/test/item.spec.ts +102 -0
  70. package/packages/gantt/src/class/view-type.ts +7 -0
  71. package/packages/gantt/src/components/bar/bar-drag.ts +298 -0
  72. package/packages/gantt/src/components/bar/bar.component.html +17 -0
  73. package/packages/gantt/src/components/bar/bar.component.scss +169 -0
  74. package/packages/gantt/src/components/bar/bar.component.ts +109 -0
  75. package/packages/gantt/src/components/bar/test/bar.component.spec.ts +54 -0
  76. package/packages/gantt/src/components/bar/test/bar.drag.spec.ts +196 -0
  77. package/packages/gantt/src/components/calendar/calendar.component.html +52 -0
  78. package/packages/gantt/src/components/calendar/calendar.component.scss +77 -0
  79. package/packages/gantt/src/components/calendar/calendar.component.ts +100 -0
  80. package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.html +6 -0
  81. package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.scss +48 -0
  82. package/packages/gantt/src/components/drag-backdrop/drag-backdrop.component.ts +13 -0
  83. package/packages/gantt/src/components/icon/icon.component.scss +13 -0
  84. package/packages/gantt/src/components/icon/icon.component.ts +28 -0
  85. package/packages/gantt/src/components/icon/icons.ts +86 -0
  86. package/packages/gantt/src/components/links/links.component.html +19 -0
  87. package/packages/gantt/src/components/links/links.component.scss +27 -0
  88. package/packages/gantt/src/components/links/links.component.ts +263 -0
  89. package/packages/gantt/src/components/main/gantt-main.component.html +35 -0
  90. package/packages/gantt/src/components/main/gantt-main.component.ts +35 -0
  91. package/packages/gantt/src/components/range/range.component.html +8 -0
  92. package/packages/gantt/src/components/range/range.component.scss +35 -0
  93. package/packages/gantt/src/components/range/range.component.ts +27 -0
  94. package/packages/gantt/src/components/range/test/range.component.spec.ts +80 -0
  95. package/packages/gantt/src/components/table/gantt-table.component.html +105 -0
  96. package/packages/gantt/src/components/table/gantt-table.component.scss +144 -0
  97. package/packages/gantt/src/components/table/gantt-table.component.ts +166 -0
  98. package/packages/gantt/src/components/table/test/table.spec.ts +129 -0
  99. package/packages/gantt/src/gantt-abstract.ts +14 -0
  100. package/packages/gantt/src/gantt-dom.service.ts +134 -0
  101. package/packages/gantt/src/gantt-drag-container.ts +73 -0
  102. package/packages/gantt/src/gantt-item-upper.ts +50 -0
  103. package/packages/gantt/src/gantt-print.service.ts +104 -0
  104. package/packages/gantt/src/gantt-upper.ts +289 -0
  105. package/packages/gantt/src/gantt.component.html +18 -0
  106. package/packages/gantt/src/gantt.component.scss +77 -0
  107. package/packages/gantt/src/gantt.component.ts +134 -0
  108. package/packages/gantt/src/gantt.module.ts +47 -0
  109. package/packages/gantt/src/gantt.pipe.ts +31 -0
  110. package/packages/gantt/src/gantt.styles.ts +28 -0
  111. package/{public-api.d.ts → packages/gantt/src/public-api.ts} +6 -0
  112. package/packages/gantt/src/root.component.html +12 -0
  113. package/packages/gantt/src/root.component.ts +121 -0
  114. package/packages/gantt/src/styles/index.scss +9 -0
  115. package/packages/gantt/src/styles/variables.scss +46 -0
  116. package/packages/gantt/src/table/gantt-column.component.ts +25 -0
  117. package/packages/gantt/src/table/gantt-table.component.ts +14 -0
  118. package/packages/gantt/src/table/test/table.spec.ts +56 -0
  119. package/packages/gantt/src/test/gantt.component.spec.ts +404 -0
  120. package/packages/gantt/src/test/mocks/data.ts +303 -0
  121. package/packages/gantt/src/test.ts +21 -0
  122. package/packages/gantt/src/utils/date.ts +276 -0
  123. package/packages/gantt/src/utils/helpers.ts +66 -0
  124. package/packages/gantt/src/utils/test/date.spec.ts +105 -0
  125. package/packages/gantt/src/utils/test/helpers.spec.ts +73 -0
  126. package/packages/gantt/src/utils/testing.ts +64 -0
  127. package/packages/gantt/src/views/day.ts +74 -0
  128. package/packages/gantt/src/views/factory.ts +25 -0
  129. package/packages/gantt/src/views/month.ts +66 -0
  130. package/packages/gantt/src/views/quarter.ts +68 -0
  131. package/packages/gantt/src/views/test/day.spec.ts +45 -0
  132. package/packages/gantt/src/views/test/factory.spec.ts +41 -0
  133. package/packages/gantt/src/views/test/mock.ts +14 -0
  134. package/packages/gantt/src/views/test/month.spec.ts +45 -0
  135. package/packages/gantt/src/views/test/quarter.spec.ts +45 -0
  136. package/packages/gantt/src/views/test/view.spec.ts +144 -0
  137. package/packages/gantt/src/views/test/week.spec.ts +45 -0
  138. package/packages/gantt/src/views/test/year.spec.ts +45 -0
  139. package/packages/gantt/src/views/view.ts +186 -0
  140. package/packages/gantt/src/views/week.ts +66 -0
  141. package/packages/gantt/src/views/year.ts +62 -0
  142. package/packages/gantt/tsconfig.lib.json +20 -0
  143. package/packages/gantt/tsconfig.lib.prod.json +9 -0
  144. package/packages/gantt/tsconfig.schematics.json +25 -0
  145. package/packages/gantt/tsconfig.spec.json +17 -0
  146. package/packages/gantt/tslint.json +18 -0
  147. package/scss-bundle.config.json +7 -0
  148. package/tsconfig.json +26 -0
  149. package/tslint.json +51 -0
  150. package/bundles/worktile-gantt.umd.js +0 -3129
  151. package/bundles/worktile-gantt.umd.js.map +0 -1
  152. package/bundles/worktile-gantt.umd.min.js +0 -16
  153. package/bundles/worktile-gantt.umd.min.js.map +0 -1
  154. package/class/date-point.d.ts +0 -15
  155. package/class/group.d.ts +0 -22
  156. package/class/item.d.ts +0 -70
  157. package/class/view-type.d.ts +0 -7
  158. package/components/bar/bar-drag.d.ts +0 -34
  159. package/components/bar/bar.component.d.ts +0 -23
  160. package/components/calendar/calendar.component.d.ts +0 -25
  161. package/components/drag-backdrop/drag-backdrop.component.d.ts +0 -6
  162. package/components/icon/icon.component.d.ts +0 -10
  163. package/components/icon/icons.d.ts +0 -8
  164. package/components/links/links.component.d.ts +0 -44
  165. package/components/main/gantt-main.component.d.ts +0 -18
  166. package/components/range/range.component.d.ts +0 -10
  167. package/components/table/gantt-table.component.d.ts +0 -31
  168. package/esm2015/class/date-point.js +0 -10
  169. package/esm2015/class/event.js +0 -13
  170. package/esm2015/class/group.js +0 -17
  171. package/esm2015/class/index.js +0 -6
  172. package/esm2015/class/item.js +0 -78
  173. package/esm2015/class/view-type.js +0 -9
  174. package/esm2015/components/bar/bar-drag.js +0 -266
  175. package/esm2015/components/bar/bar.component.js +0 -91
  176. package/esm2015/components/calendar/calendar.component.js +0 -82
  177. package/esm2015/components/drag-backdrop/drag-backdrop.component.js +0 -18
  178. package/esm2015/components/icon/icon.component.js +0 -36
  179. package/esm2015/components/icon/icons.js +0 -87
  180. package/esm2015/components/links/links.component.js +0 -207
  181. package/esm2015/components/main/gantt-main.component.js +0 -35
  182. package/esm2015/components/range/range.component.js +0 -32
  183. package/esm2015/components/table/gantt-table.component.js +0 -128
  184. package/esm2015/gantt-dom.service.js +0 -101
  185. package/esm2015/gantt-drag-container.js +0 -57
  186. package/esm2015/gantt-item-upper.js +0 -55
  187. package/esm2015/gantt-print.service.js +0 -92
  188. package/esm2015/gantt-upper.js +0 -231
  189. package/esm2015/gantt.component.js +0 -105
  190. package/esm2015/gantt.module.js +0 -43
  191. package/esm2015/gantt.pipe.js +0 -33
  192. package/esm2015/gantt.styles.js +0 -15
  193. package/esm2015/public-api.js +0 -16
  194. package/esm2015/root.component.js +0 -111
  195. package/esm2015/table/gantt-column.component.js +0 -28
  196. package/esm2015/table/gantt-table.component.js +0 -18
  197. package/esm2015/utils/date.js +0 -160
  198. package/esm2015/utils/helpers.js +0 -45
  199. package/esm2015/views/day.js +0 -54
  200. package/esm2015/views/factory.js +0 -23
  201. package/esm2015/views/month.js +0 -48
  202. package/esm2015/views/quarter.js +0 -51
  203. package/esm2015/views/view.js +0 -121
  204. package/esm2015/views/week.js +0 -49
  205. package/esm2015/views/year.js +0 -50
  206. package/esm2015/worktile-gantt.js +0 -16
  207. package/fesm2015/worktile-gantt.js +0 -2491
  208. package/fesm2015/worktile-gantt.js.map +0 -1
  209. package/gantt-dom.service.d.ts +0 -29
  210. package/gantt-drag-container.d.ts +0 -20
  211. package/gantt-item-upper.d.ts +0 -17
  212. package/gantt-print.service.d.ts +0 -10
  213. package/gantt-upper.d.ts +0 -62
  214. package/gantt.component.d.ts +0 -28
  215. package/gantt.module.d.ts +0 -2
  216. package/gantt.pipe.d.ts +0 -11
  217. package/gantt.styles.d.ts +0 -15
  218. package/root.component.d.ts +0 -25
  219. package/style.scss +0 -645
  220. package/table/gantt-column.component.d.ts +0 -12
  221. package/table/gantt-table.component.d.ts +0 -7
  222. package/utils/date.d.ts +0 -59
  223. package/utils/helpers.d.ts +0 -11
  224. package/views/day.d.ts +0 -14
  225. package/views/factory.d.ts +0 -8
  226. package/views/month.d.ts +0 -12
  227. package/views/quarter.d.ts +0 -12
  228. package/views/view.d.ts +0 -56
  229. package/views/week.d.ts +0 -12
  230. package/views/year.d.ts +0 -12
  231. package/worktile-gantt.d.ts +0 -15
  232. package/worktile-gantt.metadata.json +0 -1
@@ -1,3129 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('rxjs/operators'), require('rxjs'), require('date-fns'), require('@angular/cdk/coercion'), require('@angular/cdk/drag-drop'), require('html2canvas')) :
3
- typeof define === 'function' && define.amd ? define('@worktile/gantt', ['exports', '@angular/core', '@angular/common', 'rxjs/operators', 'rxjs', 'date-fns', '@angular/cdk/coercion', '@angular/cdk/drag-drop', 'html2canvas'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.worktile = global.worktile || {}, global.worktile.gantt = {}), global.ng.core, global.ng.common, global.rxjs.operators, global.rxjs, global.dateFns, global.ng.cdk.coercion, global.ng.cdk.dragDrop, global.html2canvas));
5
- }(this, (function (exports, core, common, operators, rxjs, dateFns, coercion, dragDrop, html2canvas) { 'use strict';
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var html2canvas__default = /*#__PURE__*/_interopDefaultLegacy(html2canvas);
10
-
11
- /*! *****************************************************************************
12
- Copyright (c) Microsoft Corporation.
13
-
14
- Permission to use, copy, modify, and/or distribute this software for any
15
- purpose with or without fee is hereby granted.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
18
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
19
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
- PERFORMANCE OF THIS SOFTWARE.
24
- ***************************************************************************** */
25
- /* global Reflect, Promise */
26
- var extendStatics = function (d, b) {
27
- extendStatics = Object.setPrototypeOf ||
28
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
29
- function (d, b) { for (var p in b)
30
- if (Object.prototype.hasOwnProperty.call(b, p))
31
- d[p] = b[p]; };
32
- return extendStatics(d, b);
33
- };
34
- function __extends(d, b) {
35
- if (typeof b !== "function" && b !== null)
36
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
37
- extendStatics(d, b);
38
- function __() { this.constructor = d; }
39
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40
- }
41
- var __assign = function () {
42
- __assign = Object.assign || function __assign(t) {
43
- for (var s, i = 1, n = arguments.length; i < n; i++) {
44
- s = arguments[i];
45
- for (var p in s)
46
- if (Object.prototype.hasOwnProperty.call(s, p))
47
- t[p] = s[p];
48
- }
49
- return t;
50
- };
51
- return __assign.apply(this, arguments);
52
- };
53
- function __rest(s, e) {
54
- var t = {};
55
- for (var p in s)
56
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
57
- t[p] = s[p];
58
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
59
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
60
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
61
- t[p[i]] = s[p[i]];
62
- }
63
- return t;
64
- }
65
- function __decorate(decorators, target, key, desc) {
66
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
67
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
68
- r = Reflect.decorate(decorators, target, key, desc);
69
- else
70
- for (var i = decorators.length - 1; i >= 0; i--)
71
- if (d = decorators[i])
72
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
73
- return c > 3 && r && Object.defineProperty(target, key, r), r;
74
- }
75
- function __param(paramIndex, decorator) {
76
- return function (target, key) { decorator(target, key, paramIndex); };
77
- }
78
- function __metadata(metadataKey, metadataValue) {
79
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
80
- return Reflect.metadata(metadataKey, metadataValue);
81
- }
82
- function __awaiter(thisArg, _arguments, P, generator) {
83
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
84
- return new (P || (P = Promise))(function (resolve, reject) {
85
- function fulfilled(value) { try {
86
- step(generator.next(value));
87
- }
88
- catch (e) {
89
- reject(e);
90
- } }
91
- function rejected(value) { try {
92
- step(generator["throw"](value));
93
- }
94
- catch (e) {
95
- reject(e);
96
- } }
97
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
98
- step((generator = generator.apply(thisArg, _arguments || [])).next());
99
- });
100
- }
101
- function __generator(thisArg, body) {
102
- var _ = { label: 0, sent: function () { if (t[0] & 1)
103
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
104
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
105
- function verb(n) { return function (v) { return step([n, v]); }; }
106
- function step(op) {
107
- if (f)
108
- throw new TypeError("Generator is already executing.");
109
- while (_)
110
- try {
111
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
112
- return t;
113
- if (y = 0, t)
114
- op = [op[0] & 2, t.value];
115
- switch (op[0]) {
116
- case 0:
117
- case 1:
118
- t = op;
119
- break;
120
- case 4:
121
- _.label++;
122
- return { value: op[1], done: false };
123
- case 5:
124
- _.label++;
125
- y = op[1];
126
- op = [0];
127
- continue;
128
- case 7:
129
- op = _.ops.pop();
130
- _.trys.pop();
131
- continue;
132
- default:
133
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
134
- _ = 0;
135
- continue;
136
- }
137
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
138
- _.label = op[1];
139
- break;
140
- }
141
- if (op[0] === 6 && _.label < t[1]) {
142
- _.label = t[1];
143
- t = op;
144
- break;
145
- }
146
- if (t && _.label < t[2]) {
147
- _.label = t[2];
148
- _.ops.push(op);
149
- break;
150
- }
151
- if (t[2])
152
- _.ops.pop();
153
- _.trys.pop();
154
- continue;
155
- }
156
- op = body.call(thisArg, _);
157
- }
158
- catch (e) {
159
- op = [6, e];
160
- y = 0;
161
- }
162
- finally {
163
- f = t = 0;
164
- }
165
- if (op[0] & 5)
166
- throw op[1];
167
- return { value: op[0] ? op[1] : void 0, done: true };
168
- }
169
- }
170
- var __createBinding = Object.create ? (function (o, m, k, k2) {
171
- if (k2 === undefined)
172
- k2 = k;
173
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
174
- }) : (function (o, m, k, k2) {
175
- if (k2 === undefined)
176
- k2 = k;
177
- o[k2] = m[k];
178
- });
179
- function __exportStar(m, o) {
180
- for (var p in m)
181
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
182
- __createBinding(o, m, p);
183
- }
184
- function __values(o) {
185
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
186
- if (m)
187
- return m.call(o);
188
- if (o && typeof o.length === "number")
189
- return {
190
- next: function () {
191
- if (o && i >= o.length)
192
- o = void 0;
193
- return { value: o && o[i++], done: !o };
194
- }
195
- };
196
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
197
- }
198
- function __read(o, n) {
199
- var m = typeof Symbol === "function" && o[Symbol.iterator];
200
- if (!m)
201
- return o;
202
- var i = m.call(o), r, ar = [], e;
203
- try {
204
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
205
- ar.push(r.value);
206
- }
207
- catch (error) {
208
- e = { error: error };
209
- }
210
- finally {
211
- try {
212
- if (r && !r.done && (m = i["return"]))
213
- m.call(i);
214
- }
215
- finally {
216
- if (e)
217
- throw e.error;
218
- }
219
- }
220
- return ar;
221
- }
222
- /** @deprecated */
223
- function __spread() {
224
- for (var ar = [], i = 0; i < arguments.length; i++)
225
- ar = ar.concat(__read(arguments[i]));
226
- return ar;
227
- }
228
- /** @deprecated */
229
- function __spreadArrays() {
230
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
231
- s += arguments[i].length;
232
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
233
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
234
- r[k] = a[j];
235
- return r;
236
- }
237
- function __spreadArray(to, from, pack) {
238
- if (pack || arguments.length === 2)
239
- for (var i = 0, l = from.length, ar; i < l; i++) {
240
- if (ar || !(i in from)) {
241
- if (!ar)
242
- ar = Array.prototype.slice.call(from, 0, i);
243
- ar[i] = from[i];
244
- }
245
- }
246
- return to.concat(ar || from);
247
- }
248
- function __await(v) {
249
- return this instanceof __await ? (this.v = v, this) : new __await(v);
250
- }
251
- function __asyncGenerator(thisArg, _arguments, generator) {
252
- if (!Symbol.asyncIterator)
253
- throw new TypeError("Symbol.asyncIterator is not defined.");
254
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
255
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
256
- function verb(n) { if (g[n])
257
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
258
- function resume(n, v) { try {
259
- step(g[n](v));
260
- }
261
- catch (e) {
262
- settle(q[0][3], e);
263
- } }
264
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
265
- function fulfill(value) { resume("next", value); }
266
- function reject(value) { resume("throw", value); }
267
- function settle(f, v) { if (f(v), q.shift(), q.length)
268
- resume(q[0][0], q[0][1]); }
269
- }
270
- function __asyncDelegator(o) {
271
- var i, p;
272
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
273
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
274
- }
275
- function __asyncValues(o) {
276
- if (!Symbol.asyncIterator)
277
- throw new TypeError("Symbol.asyncIterator is not defined.");
278
- var m = o[Symbol.asyncIterator], i;
279
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
280
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
281
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
282
- }
283
- function __makeTemplateObject(cooked, raw) {
284
- if (Object.defineProperty) {
285
- Object.defineProperty(cooked, "raw", { value: raw });
286
- }
287
- else {
288
- cooked.raw = raw;
289
- }
290
- return cooked;
291
- }
292
- ;
293
- var __setModuleDefault = Object.create ? (function (o, v) {
294
- Object.defineProperty(o, "default", { enumerable: true, value: v });
295
- }) : function (o, v) {
296
- o["default"] = v;
297
- };
298
- function __importStar(mod) {
299
- if (mod && mod.__esModule)
300
- return mod;
301
- var result = {};
302
- if (mod != null)
303
- for (var k in mod)
304
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
305
- __createBinding(result, mod, k);
306
- __setModuleDefault(result, mod);
307
- return result;
308
- }
309
- function __importDefault(mod) {
310
- return (mod && mod.__esModule) ? mod : { default: mod };
311
- }
312
- function __classPrivateFieldGet(receiver, state, kind, f) {
313
- if (kind === "a" && !f)
314
- throw new TypeError("Private accessor was defined without a getter");
315
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
316
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
317
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
318
- }
319
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
320
- if (kind === "m")
321
- throw new TypeError("Private method is not writable");
322
- if (kind === "a" && !f)
323
- throw new TypeError("Private accessor was defined without a setter");
324
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
325
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
326
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
327
- }
328
-
329
- var GanttDatePoint = /** @class */ (function () {
330
- function GanttDatePoint(start, text, x, y, additions) {
331
- this.start = start;
332
- this.text = text;
333
- this.x = x;
334
- this.y = y;
335
- this.additions = additions;
336
- }
337
- return GanttDatePoint;
338
- }());
339
-
340
- var GanttDragEvent = /** @class */ (function () {
341
- function GanttDragEvent() {
342
- }
343
- return GanttDragEvent;
344
- }());
345
- var GanttTableEvent = /** @class */ (function () {
346
- function GanttTableEvent() {
347
- }
348
- return GanttTableEvent;
349
- }());
350
- var GanttLinkDragEvent = /** @class */ (function () {
351
- function GanttLinkDragEvent() {
352
- }
353
- return GanttLinkDragEvent;
354
- }());
355
- var GanttLoadOnScrollEvent = /** @class */ (function () {
356
- function GanttLoadOnScrollEvent() {
357
- }
358
- return GanttLoadOnScrollEvent;
359
- }());
360
- var GanttLineClickEvent = /** @class */ (function () {
361
- function GanttLineClickEvent() {
362
- }
363
- return GanttLineClickEvent;
364
- }());
365
- var GanttBarClickEvent = /** @class */ (function () {
366
- function GanttBarClickEvent() {
367
- }
368
- return GanttBarClickEvent;
369
- }());
370
-
371
- var GanttDate = /** @class */ (function () {
372
- function GanttDate(date) {
373
- if (date) {
374
- if (date instanceof Date) {
375
- this.value = date;
376
- }
377
- else if (typeof date === 'string' || typeof date === 'number') {
378
- if (date.toString().length < 13) {
379
- this.value = dateFns.fromUnixTime(+date);
380
- }
381
- else {
382
- this.value = new Date(date);
383
- }
384
- }
385
- else {
386
- throw new Error("The input date type is not supported expect Date | string\n | number | { date: number; with_time: 0 | 1}, actual " + JSON.stringify(date));
387
- }
388
- }
389
- else {
390
- this.value = new Date();
391
- }
392
- }
393
- GanttDate.prototype.getYear = function () {
394
- return this.value.getFullYear();
395
- };
396
- GanttDate.prototype.getMonth = function () {
397
- return this.value.getMonth();
398
- };
399
- GanttDate.prototype.getDay = function () {
400
- return this.value.getDay();
401
- };
402
- GanttDate.prototype.getTime = function () {
403
- return this.value.getTime();
404
- };
405
- GanttDate.prototype.getDate = function () {
406
- return this.value.getDate();
407
- };
408
- GanttDate.prototype.getHours = function () {
409
- return this.value.getHours();
410
- };
411
- GanttDate.prototype.getMinutes = function () {
412
- return this.value.getMinutes();
413
- };
414
- GanttDate.prototype.getSeconds = function () {
415
- return this.value.getSeconds();
416
- };
417
- GanttDate.prototype.getMilliseconds = function () {
418
- return this.value.getMilliseconds();
419
- };
420
- GanttDate.prototype.getWeek = function (options) {
421
- if (options === void 0) { options = { weekStartsOn: 1 }; }
422
- return dateFns.getWeek(this.value, options);
423
- };
424
- GanttDate.prototype.getDaysInMonth = function () {
425
- return dateFns.getDaysInMonth(this.value);
426
- };
427
- GanttDate.prototype.getDaysInQuarter = function () {
428
- return dateFns.differenceInCalendarDays(this.endOfQuarter().addSeconds(1).value, this.startOfQuarter().value);
429
- };
430
- GanttDate.prototype.getDaysInYear = function () {
431
- return dateFns.differenceInCalendarDays(this.endOfYear().addSeconds(1).value, this.startOfYear().value);
432
- };
433
- GanttDate.prototype.setDate = function (dayOfMonth) {
434
- return new GanttDate(dateFns.setDate(this.value, dayOfMonth));
435
- };
436
- GanttDate.prototype.clone = function () {
437
- return new GanttDate(new Date(this.value));
438
- };
439
- GanttDate.prototype.add = function (amount, unit) {
440
- switch (unit) {
441
- case 'second':
442
- return new GanttDate(this.value).addSeconds(amount);
443
- case 'minute':
444
- return new GanttDate(this.value).addMinutes(amount);
445
- case 'hour':
446
- return new GanttDate(this.value).addHours(amount);
447
- case 'day':
448
- return new GanttDate(this.value).addDays(amount);
449
- case 'week':
450
- return new GanttDate(this.value).addWeeks(amount);
451
- case 'month':
452
- return new GanttDate(this.value).addMonths(amount);
453
- case 'quarter':
454
- return new GanttDate(this.value).addQuarters(amount);
455
- case 'year':
456
- return new GanttDate(this.value).addYears(amount);
457
- default:
458
- return new GanttDate(this.value).addSeconds(amount);
459
- }
460
- };
461
- GanttDate.prototype.addSeconds = function (amount) {
462
- return new GanttDate(dateFns.addSeconds(this.value, amount));
463
- };
464
- GanttDate.prototype.addMinutes = function (amount) {
465
- return new GanttDate(dateFns.addMinutes(this.value, amount));
466
- };
467
- GanttDate.prototype.addHours = function (amount) {
468
- return new GanttDate(dateFns.addHours(this.value, amount));
469
- };
470
- GanttDate.prototype.addDays = function (amount) {
471
- return new GanttDate(dateFns.addDays(this.value, amount));
472
- };
473
- GanttDate.prototype.addWeeks = function (amount) {
474
- return new GanttDate(dateFns.addWeeks(this.value, amount));
475
- };
476
- GanttDate.prototype.addMonths = function (amount) {
477
- return new GanttDate(dateFns.addMonths(this.value, amount));
478
- };
479
- GanttDate.prototype.addQuarters = function (amount) {
480
- return new GanttDate(dateFns.addQuarters(this.value, amount));
481
- };
482
- GanttDate.prototype.addYears = function (amount) {
483
- return new GanttDate(dateFns.addYears(this.value, amount));
484
- };
485
- GanttDate.prototype.startOfDay = function () {
486
- return new GanttDate(dateFns.startOfDay(this.value));
487
- };
488
- GanttDate.prototype.startOfWeek = function (options) {
489
- return new GanttDate(dateFns.startOfWeek(this.value, options));
490
- };
491
- GanttDate.prototype.startOfMonth = function () {
492
- return new GanttDate(dateFns.startOfMonth(this.value));
493
- };
494
- GanttDate.prototype.startOfQuarter = function () {
495
- return new GanttDate(dateFns.startOfQuarter(this.value));
496
- };
497
- GanttDate.prototype.startOfYear = function () {
498
- return new GanttDate(dateFns.startOfYear(this.value));
499
- };
500
- GanttDate.prototype.endOfDay = function () {
501
- return new GanttDate(dateFns.endOfDay(this.value));
502
- };
503
- GanttDate.prototype.endOfWeek = function (options) {
504
- return new GanttDate(dateFns.endOfWeek(this.value, options));
505
- };
506
- GanttDate.prototype.endOfMonth = function () {
507
- return new GanttDate(dateFns.endOfMonth(this.value));
508
- };
509
- GanttDate.prototype.endOfQuarter = function () {
510
- return new GanttDate(dateFns.endOfQuarter(this.value));
511
- };
512
- GanttDate.prototype.endOfYear = function () {
513
- return new GanttDate(dateFns.endOfYear(this.value));
514
- };
515
- GanttDate.prototype.getUnixTime = function () {
516
- return dateFns.getUnixTime(this.value);
517
- };
518
- GanttDate.prototype.format = function (mat, options) {
519
- return dateFns.format(this.value, mat, options);
520
- };
521
- GanttDate.prototype.isWeekend = function () {
522
- return dateFns.isWeekend(this.value);
523
- };
524
- GanttDate.prototype.isToday = function () {
525
- return dateFns.isToday(this.value);
526
- };
527
- return GanttDate;
528
- }());
529
-
530
- (function (GanttViewType) {
531
- GanttViewType["day"] = "day";
532
- GanttViewType["quarter"] = "quarter";
533
- GanttViewType["month"] = "month";
534
- GanttViewType["year"] = "year";
535
- GanttViewType["week"] = "week";
536
- })(exports.GanttViewType || (exports.GanttViewType = {}));
537
-
538
- (function (GanttItemType) {
539
- GanttItemType["bar"] = "bar";
540
- GanttItemType["range"] = "range";
541
- GanttItemType["custom"] = "custom";
542
- })(exports.GanttItemType || (exports.GanttItemType = {}));
543
- var GanttItemInternal = /** @class */ (function () {
544
- function GanttItemInternal(item, options) {
545
- var _this = this;
546
- this.refs$ = new rxjs.BehaviorSubject(null);
547
- this.origin = item;
548
- this.id = this.origin.id;
549
- this.links = this.origin.links || [];
550
- this.color = this.origin.color;
551
- this.barStyle = this.origin.barStyle;
552
- this.linkable = this.origin.linkable === undefined ? true : this.origin.linkable;
553
- this.draggable = this.origin.draggable === undefined ? true : this.origin.draggable;
554
- this.expandable = this.origin.expandable || (this.origin.children || []).length > 0;
555
- this.expanded = this.origin.expanded === undefined ? false : this.origin.expanded;
556
- this.start = item.start ? new GanttDate(item.start) : null;
557
- this.end = item.end ? new GanttDate(item.end) : null;
558
- this.viewType = options && options.viewType ? options.viewType : exports.GanttViewType.month;
559
- this.children = (item.children || []).map(function (subItem) {
560
- return new GanttItemInternal(subItem, { viewType: _this.viewType });
561
- });
562
- this.type = this.origin.type || exports.GanttItemType.bar;
563
- this.progress = this.origin.progress;
564
- // fill one month when start or end is null
565
- this.fillItemStartOrEnd(item);
566
- }
567
- Object.defineProperty(GanttItemInternal.prototype, "refs", {
568
- get: function () {
569
- return this.refs$.getValue();
570
- },
571
- enumerable: false,
572
- configurable: true
573
- });
574
- GanttItemInternal.prototype.fillItemStartOrEnd = function (item) {
575
- var addInterval;
576
- switch (this.viewType) {
577
- case exports.GanttViewType.day:
578
- case exports.GanttViewType.week:
579
- addInterval = 0;
580
- break;
581
- default:
582
- addInterval = 30;
583
- break;
584
- }
585
- if (item.start && !item.end) {
586
- this.end = new GanttDate(item.start).addDays(addInterval).endOfDay();
587
- }
588
- if (!item.start && item.end) {
589
- this.start = new GanttDate(item.end).addDays(-addInterval).startOfDay();
590
- }
591
- };
592
- GanttItemInternal.prototype.updateRefs = function (refs) {
593
- this.refs$.next(refs);
594
- };
595
- GanttItemInternal.prototype.updateDate = function (start, end) {
596
- this.start = start.startOfDay();
597
- this.end = end.endOfDay();
598
- this.origin.start = this.start.getUnixTime();
599
- this.origin.end = this.end.getUnixTime();
600
- };
601
- GanttItemInternal.prototype.addChildren = function (items) {
602
- var _this = this;
603
- this.origin.children = items;
604
- this.children = (items || []).map(function (subItem) {
605
- return new GanttItemInternal(subItem, { viewType: _this.viewType });
606
- });
607
- };
608
- GanttItemInternal.prototype.setExpand = function (expanded) {
609
- this.expanded = expanded;
610
- this.origin.expanded = expanded;
611
- };
612
- GanttItemInternal.prototype.addLink = function (linkId) {
613
- this.links = __spread(this.links, [linkId]);
614
- this.origin.links = this.links;
615
- };
616
- return GanttItemInternal;
617
- }());
618
-
619
- var GanttGroupInternal = /** @class */ (function () {
620
- function GanttGroupInternal(group) {
621
- this.refs = {};
622
- this.id = group.id;
623
- this.origin = group;
624
- this.title = group.title;
625
- this.expanded = group.expanded === undefined ? true : group.expanded;
626
- this.items = [];
627
- this.mergedItems = [[]];
628
- this.class = group.class || '';
629
- }
630
- GanttGroupInternal.prototype.setExpand = function (expanded) {
631
- this.expanded = expanded;
632
- this.origin.expanded = expanded;
633
- };
634
- return GanttGroupInternal;
635
- }());
636
-
637
- var primaryDatePointTop = 18;
638
- var secondaryDatePointTop = 36;
639
- var viewOptions = {
640
- min: new GanttDate().addYears(-1).startOfYear(),
641
- max: new GanttDate().addYears(1).endOfYear()
642
- };
643
- var GanttView = /** @class */ (function () {
644
- function GanttView(start, end, options) {
645
- this.showTimeline = true;
646
- this.options = Object.assign({}, viewOptions, options);
647
- var startDate = start.isCustom
648
- ? this.startOf(start.date)
649
- : this.startOf(start.date.value < this.options.start.value ? start.date : this.options.start);
650
- var endDate = end.isCustom
651
- ? this.endOf(end.date)
652
- : this.endOf(end.date.value > this.options.end.value ? end.date : this.options.end);
653
- this.start$ = new rxjs.BehaviorSubject(startDate);
654
- this.end$ = new rxjs.BehaviorSubject(endDate);
655
- this.initialize();
656
- }
657
- Object.defineProperty(GanttView.prototype, "start", {
658
- get: function () {
659
- return this.start$.getValue();
660
- },
661
- enumerable: false,
662
- configurable: true
663
- });
664
- Object.defineProperty(GanttView.prototype, "end", {
665
- get: function () {
666
- return this.end$.getValue();
667
- },
668
- enumerable: false,
669
- configurable: true
670
- });
671
- GanttView.prototype.getDateIntervalWidth = function (start, end) {
672
- var result = 0;
673
- var days = dateFns.differenceInDays(end.value, start.value);
674
- for (var i = 0; i < Math.abs(days); i++) {
675
- result += this.getDayOccupancyWidth(start.addDays(i));
676
- }
677
- result = days >= 0 ? result : -result;
678
- return Number(result.toFixed(3));
679
- };
680
- GanttView.prototype.initialize = function () {
681
- this.primaryDatePoints = this.getPrimaryDatePoints();
682
- this.secondaryDatePoints = this.getSecondaryDatePoints();
683
- this.width = this.getWidth();
684
- this.cellWidth = this.getCellWidth();
685
- this.primaryWidth = this.getPrimaryWidth();
686
- };
687
- GanttView.prototype.addStartDate = function () {
688
- var start = this.startOf(this.start.add(this.options.addAmount * -1, this.options.addUnit));
689
- if (start.value >= this.options.min.value) {
690
- var origin = this.start;
691
- this.start$.next(start);
692
- this.initialize();
693
- return { start: this.start, end: origin };
694
- }
695
- return null;
696
- };
697
- GanttView.prototype.addEndDate = function () {
698
- var end = this.endOf(this.end.add(this.options.addAmount, this.options.addUnit));
699
- if (end.value <= this.options.max.value) {
700
- var origin = this.end;
701
- this.end$.next(end);
702
- this.initialize();
703
- return { start: origin, end: this.end };
704
- }
705
- return null;
706
- };
707
- GanttView.prototype.updateDate = function (start, end) {
708
- start = this.startOf(start);
709
- end = this.endOf(end);
710
- if (start.value < this.start.value) {
711
- this.start$.next(start);
712
- }
713
- if (end.value > this.end.value) {
714
- this.end$.next(end);
715
- }
716
- this.initialize();
717
- };
718
- // 获取View的宽度
719
- GanttView.prototype.getWidth = function () {
720
- return this.getCellWidth() * this.secondaryDatePoints.length;
721
- };
722
- // 获取单个网格的宽度
723
- GanttView.prototype.getCellWidth = function () {
724
- return this.options.cellWidth;
725
- };
726
- // 获取当前时间的X坐标
727
- GanttView.prototype.getTodayXPoint = function () {
728
- var toady = new GanttDate().startOfDay();
729
- if (toady.value > this.start.value && toady.value < this.end.value) {
730
- var x = this.getXPointByDate(toady) + this.getDayOccupancyWidth(toady) / 2;
731
- return x;
732
- }
733
- else {
734
- return null;
735
- }
736
- };
737
- // 获取指定时间的X坐标
738
- GanttView.prototype.getXPointByDate = function (date) {
739
- return this.getDateIntervalWidth(this.start, date);
740
- };
741
- // 根据X坐标获取对应时间
742
- GanttView.prototype.getDateByXPoint = function (x) {
743
- var indexOfSecondaryDate = Math.floor(x / this.getCellWidth());
744
- var matchDate = this.secondaryDatePoints[indexOfSecondaryDate];
745
- var dayWidth = this.getDayOccupancyWidth(matchDate === null || matchDate === void 0 ? void 0 : matchDate.start);
746
- if (dayWidth === this.getCellWidth()) {
747
- return matchDate === null || matchDate === void 0 ? void 0 : matchDate.start;
748
- }
749
- else {
750
- var day = Math.floor((x % this.getCellWidth()) / dayWidth) + 1;
751
- if (this.getCellWidth() / dayWidth === 7) {
752
- return matchDate === null || matchDate === void 0 ? void 0 : matchDate.start.addDays(day);
753
- }
754
- return matchDate === null || matchDate === void 0 ? void 0 : matchDate.start.setDate(day);
755
- }
756
- };
757
- // 获取指定时间范围的宽度
758
- GanttView.prototype.getDateRangeWidth = function (start, end) {
759
- // addSeconds(1) 是因为计算相差天会以一个整天来计算 end时间一般是59分59秒不是一个整天,所以需要加1
760
- return this.getDateIntervalWidth(start, end.addSeconds(1));
761
- };
762
- return GanttView;
763
- }());
764
-
765
- var viewOptions$1 = {
766
- start: new GanttDate().startOfQuarter().addQuarters(-1),
767
- end: new GanttDate().endOfQuarter().addQuarters(2),
768
- cellWidth: 280,
769
- addAmount: 1,
770
- addUnit: 'quarter'
771
- };
772
- var GanttViewMonth = /** @class */ (function (_super) {
773
- __extends(GanttViewMonth, _super);
774
- function GanttViewMonth(start, end, options) {
775
- return _super.call(this, start, end, Object.assign({}, viewOptions$1, options)) || this;
776
- }
777
- GanttViewMonth.prototype.startOf = function (date) {
778
- return date.startOfQuarter();
779
- };
780
- GanttViewMonth.prototype.endOf = function (date) {
781
- return date.endOfQuarter();
782
- };
783
- GanttViewMonth.prototype.getPrimaryWidth = function () {
784
- return this.getCellWidth() * 3;
785
- };
786
- GanttViewMonth.prototype.getDayOccupancyWidth = function (date) {
787
- return this.cellWidth / date.getDaysInMonth();
788
- };
789
- GanttViewMonth.prototype.getPrimaryDatePoints = function () {
790
- var quarters = dateFns.differenceInCalendarQuarters(this.end.addSeconds(1).value, this.start.value);
791
- var points = [];
792
- for (var i = 0; i < quarters; i++) {
793
- var start = this.start.addQuarters(i);
794
- var point = new GanttDatePoint(start, start.format('yyyy年QQQ'), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
795
- points.push(point);
796
- }
797
- return points;
798
- };
799
- GanttViewMonth.prototype.getSecondaryDatePoints = function () {
800
- var months = dateFns.eachMonthOfInterval({ start: this.start.value, end: this.end.value });
801
- var points = [];
802
- for (var i = 0; i < months.length; i++) {
803
- var start = new GanttDate(months[i]);
804
- var point = new GanttDatePoint(start, start.getMonth() + 1 + "\u6708", i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
805
- points.push(point);
806
- }
807
- return points;
808
- };
809
- return GanttViewMonth;
810
- }(GanttView));
811
-
812
- var viewOptions$2 = {
813
- start: new GanttDate().addYears(-1).startOfYear(),
814
- end: new GanttDate().addYears(1).endOfYear(),
815
- min: new GanttDate().addYears(-2).startOfYear(),
816
- max: new GanttDate().addYears(2).endOfYear(),
817
- cellWidth: 500,
818
- addAmount: 1,
819
- addUnit: 'year'
820
- };
821
- var GanttViewQuarter = /** @class */ (function (_super) {
822
- __extends(GanttViewQuarter, _super);
823
- function GanttViewQuarter(start, end, options) {
824
- return _super.call(this, start, end, Object.assign({}, viewOptions$2, options)) || this;
825
- }
826
- GanttViewQuarter.prototype.startOf = function (date) {
827
- return date.startOfYear();
828
- };
829
- GanttViewQuarter.prototype.endOf = function (date) {
830
- return date.endOfYear();
831
- };
832
- GanttViewQuarter.prototype.getPrimaryWidth = function () {
833
- return this.getCellWidth() * 4;
834
- };
835
- GanttViewQuarter.prototype.getDayOccupancyWidth = function (date) {
836
- return this.cellWidth / date.getDaysInQuarter();
837
- };
838
- GanttViewQuarter.prototype.getPrimaryDatePoints = function () {
839
- var years = dateFns.eachYearOfInterval({ start: this.start.value, end: this.end.value });
840
- var points = [];
841
- for (var i = 0; i < years.length; i++) {
842
- var start = new GanttDate(years[i]);
843
- var point = new GanttDatePoint(start, start.format('yyyy') + "\u5E74", (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
844
- points.push(point);
845
- }
846
- return points;
847
- };
848
- GanttViewQuarter.prototype.getSecondaryDatePoints = function () {
849
- var quarters = dateFns.differenceInCalendarQuarters(this.end.value, this.start.value);
850
- var points = [];
851
- for (var i = 0; i <= quarters; i++) {
852
- var start = this.start.addQuarters(i);
853
- var point = new GanttDatePoint(start, start.format('QQQ'), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
854
- points.push(point);
855
- }
856
- return points;
857
- };
858
- return GanttViewQuarter;
859
- }(GanttView));
860
-
861
- var viewOptions$3 = {
862
- cellWidth: 35,
863
- start: new GanttDate().startOfYear().startOfWeek({ weekStartsOn: 1 }),
864
- end: new GanttDate().endOfYear().endOfWeek({ weekStartsOn: 1 }),
865
- addAmount: 1,
866
- addUnit: 'month'
867
- };
868
- var GanttViewDay = /** @class */ (function (_super) {
869
- __extends(GanttViewDay, _super);
870
- function GanttViewDay(start, end, options) {
871
- var _this = _super.call(this, start, end, Object.assign({}, viewOptions$3, options)) || this;
872
- _this.showWeekBackdrop = true;
873
- _this.showTimeline = false;
874
- return _this;
875
- }
876
- GanttViewDay.prototype.startOf = function (date) {
877
- return date.startOfWeek({ weekStartsOn: 1 });
878
- };
879
- GanttViewDay.prototype.endOf = function (date) {
880
- return date.endOfWeek({ weekStartsOn: 1 });
881
- };
882
- GanttViewDay.prototype.getPrimaryWidth = function () {
883
- return this.getCellWidth() * 7;
884
- };
885
- GanttViewDay.prototype.getDayOccupancyWidth = function () {
886
- return this.cellWidth;
887
- };
888
- GanttViewDay.prototype.getPrimaryDatePoints = function () {
889
- var weeks = dateFns.eachWeekOfInterval({ start: this.start.value, end: this.end.addSeconds(1).value }, { weekStartsOn: 1 });
890
- var points = [];
891
- for (var i = 0; i < weeks.length; i++) {
892
- var weekStart = new GanttDate(weeks[i]);
893
- var increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
894
- var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format('yyyy年MM月'), (this.getCellWidth() * 7) / 2 + i * (this.getCellWidth() * 7), primaryDatePointTop);
895
- points.push(point);
896
- }
897
- return points;
898
- };
899
- GanttViewDay.prototype.getSecondaryDatePoints = function () {
900
- var days = dateFns.eachDayOfInterval({ start: this.start.value, end: this.end.value });
901
- var points = [];
902
- for (var i = 0; i < days.length; i++) {
903
- var start = new GanttDate(days[i]);
904
- var point = new GanttDatePoint(start, start.getDate().toString(), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop, {
905
- isWeekend: start.isWeekend(),
906
- isToday: start.isToday()
907
- });
908
- points.push(point);
909
- }
910
- return points;
911
- };
912
- return GanttViewDay;
913
- }(GanttView));
914
-
915
- var viewOptions$4 = {
916
- cellWidth: 280,
917
- start: new GanttDate().startOfYear().startOfWeek({ weekStartsOn: 1 }),
918
- end: new GanttDate().endOfYear().endOfWeek({ weekStartsOn: 1 }),
919
- addAmount: 1,
920
- addUnit: 'month'
921
- };
922
- var GanttViewWeek = /** @class */ (function (_super) {
923
- __extends(GanttViewWeek, _super);
924
- function GanttViewWeek(start, end, options) {
925
- return _super.call(this, start, end, Object.assign({}, viewOptions$4, options)) || this;
926
- }
927
- GanttViewWeek.prototype.startOf = function (date) {
928
- return date.startOfWeek({ weekStartsOn: 1 });
929
- };
930
- GanttViewWeek.prototype.endOf = function (date) {
931
- return date.endOfWeek({ weekStartsOn: 1 });
932
- };
933
- GanttViewWeek.prototype.getPrimaryWidth = function () {
934
- return this.getCellWidth();
935
- };
936
- GanttViewWeek.prototype.getDayOccupancyWidth = function () {
937
- return this.cellWidth / 7;
938
- };
939
- GanttViewWeek.prototype.getPrimaryDatePoints = function () {
940
- var weeks = dateFns.eachWeekOfInterval({ start: this.start.value, end: this.end.addSeconds(1).value }, { weekStartsOn: 1 });
941
- var points = [];
942
- for (var i = 0; i < weeks.length; i++) {
943
- var weekStart = new GanttDate(weeks[i]);
944
- var increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
945
- var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format('yyyy年'), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
946
- points.push(point);
947
- }
948
- return points;
949
- };
950
- GanttViewWeek.prototype.getSecondaryDatePoints = function () {
951
- var weeks = dateFns.eachWeekOfInterval({ start: this.start.value, end: this.end.value });
952
- var points = [];
953
- for (var i = 0; i < weeks.length; i++) {
954
- var start = new GanttDate(weeks[i]);
955
- var point = new GanttDatePoint(start, "\u7B2C" + start.format('w') + "\u5468", i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
956
- points.push(point);
957
- }
958
- return points;
959
- };
960
- return GanttViewWeek;
961
- }(GanttView));
962
-
963
- var viewOptions$5 = {
964
- cellWidth: 480,
965
- start: new GanttDate().addYears(-1).startOfYear(),
966
- end: new GanttDate().addYears(1).endOfYear(),
967
- addAmount: 1,
968
- addUnit: 'year'
969
- };
970
- var GanttViewYear = /** @class */ (function (_super) {
971
- __extends(GanttViewYear, _super);
972
- function GanttViewYear(start, end, options) {
973
- return _super.call(this, start, end, Object.assign({}, viewOptions$5, options)) || this;
974
- }
975
- GanttViewYear.prototype.startOf = function (date) {
976
- return date.startOfYear();
977
- };
978
- GanttViewYear.prototype.endOf = function (date) {
979
- return date.endOfYear();
980
- };
981
- GanttViewYear.prototype.getPrimaryWidth = function () {
982
- return this.getCellWidth();
983
- };
984
- GanttViewYear.prototype.getDayOccupancyWidth = function (date) {
985
- return this.cellWidth / date.getDaysInYear();
986
- };
987
- GanttViewYear.prototype.getPrimaryDatePoints = function () {
988
- var years = dateFns.eachYearOfInterval({ start: this.start.value, end: this.end.value });
989
- var points = [];
990
- for (var i = 0; i < years.length; i++) {
991
- var start = new GanttDate(years[i]);
992
- var point = new GanttDatePoint(start, "", this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
993
- points.push(point);
994
- }
995
- return points;
996
- };
997
- GanttViewYear.prototype.getSecondaryDatePoints = function () {
998
- var years = dateFns.differenceInCalendarYears(this.end.value, this.start.value);
999
- var points = [];
1000
- var pointTop = 27;
1001
- for (var i = 0; i <= years; i++) {
1002
- var start = this.start.addYears(i);
1003
- var point = new GanttDatePoint(start, start.format('yyyy') + "\u5E74", i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
1004
- points.push(point);
1005
- }
1006
- return points;
1007
- };
1008
- return GanttViewYear;
1009
- }(GanttView));
1010
-
1011
- function createViewFactory(type, start, end, options) {
1012
- switch (type) {
1013
- case exports.GanttViewType.month:
1014
- return new GanttViewMonth(start, end, options);
1015
- case exports.GanttViewType.week:
1016
- return new GanttViewWeek(start, end, options);
1017
- case exports.GanttViewType.quarter:
1018
- return new GanttViewQuarter(start, end, options);
1019
- case exports.GanttViewType.day:
1020
- return new GanttViewDay(start, end, options);
1021
- case exports.GanttViewType.year:
1022
- return new GanttViewYear(start, end, options);
1023
- default:
1024
- throw new Error('gantt view type invalid');
1025
- }
1026
- }
1027
-
1028
- var defaultStyles = {
1029
- lineHeight: 44,
1030
- barHeight: 22
1031
- };
1032
- var headerHeight = 44;
1033
- var sideWidth = 400;
1034
- var sideMiddleWidth = 500;
1035
- var sideMaxWidth = 600;
1036
- var sideMinWidth = 400;
1037
- var barBackground = '#348fe4';
1038
- var rangeHeight = 17;
1039
- var todayHeight = 24;
1040
- var todayWidth = 35;
1041
- var todayBorderRadius = 4;
1042
-
1043
- function isNumber(value) {
1044
- return typeof value === 'number';
1045
- }
1046
- function isString(value) {
1047
- return typeof value === 'string';
1048
- }
1049
- function isUndefined(value) {
1050
- return value === undefined;
1051
- }
1052
- function hexToRgb(color, opacity) {
1053
- if (opacity === void 0) { opacity = 1; }
1054
- if (/^#/g.test(color)) {
1055
- return "rgba(" + parseInt(color.slice(1, 3), 16) + "," + parseInt(color.slice(3, 5), 16) + "," + parseInt(color.slice(5, 7), 16) + "," + opacity + ")";
1056
- }
1057
- else {
1058
- return color;
1059
- }
1060
- }
1061
- function uniqBy(array, key) {
1062
- var valuesMap = {};
1063
- var result = [];
1064
- (array || []).forEach(function (value) {
1065
- var _key = value[key];
1066
- if (!valuesMap[_key]) {
1067
- valuesMap[_key] = value;
1068
- result.push(value);
1069
- }
1070
- });
1071
- return result;
1072
- }
1073
- function flatten(array) {
1074
- return array.reduce(function (pre, cur) {
1075
- return pre.concat(Array.isArray(cur) ? flatten(cur) : cur);
1076
- }, []);
1077
- }
1078
- function recursiveItems(items) {
1079
- var result = [];
1080
- (items || []).forEach(function (item) {
1081
- result.push(item);
1082
- if (item.expanded && item.children) {
1083
- result.push.apply(result, __spread(recursiveItems(item.children)));
1084
- }
1085
- });
1086
- return result;
1087
- }
1088
-
1089
- var GanttUpper = /** @class */ (function () {
1090
- function GanttUpper(elementRef, cdr, ngZone) {
1091
- this.elementRef = elementRef;
1092
- this.cdr = cdr;
1093
- this.ngZone = ngZone;
1094
- this.originItems = [];
1095
- this.originGroups = [];
1096
- this.viewType = exports.GanttViewType.month;
1097
- this.showTodayLine = true;
1098
- this.loadOnScroll = new core.EventEmitter();
1099
- this.dragStarted = new core.EventEmitter();
1100
- this.dragEnded = new core.EventEmitter();
1101
- this.barClick = new core.EventEmitter();
1102
- this.linkDragEnded = new core.EventEmitter();
1103
- this.items = [];
1104
- this.groups = [];
1105
- this.viewChange = new core.EventEmitter();
1106
- this.expandChange = new core.EventEmitter();
1107
- this.firstChange = true;
1108
- this.unsubscribe$ = new rxjs.Subject();
1109
- this.expandedItemIds = [];
1110
- this.ganttClass = true;
1111
- }
1112
- Object.defineProperty(GanttUpper.prototype, "element", {
1113
- get: function () {
1114
- return this.elementRef.nativeElement;
1115
- },
1116
- enumerable: false,
1117
- configurable: true
1118
- });
1119
- GanttUpper.prototype.createView = function () {
1120
- var viewDate = this.getViewDate();
1121
- this.view = createViewFactory(this.viewType, viewDate.start, viewDate.end, this.viewOptions);
1122
- };
1123
- GanttUpper.prototype.setupGroups = function () {
1124
- var _this = this;
1125
- var collapsedIds = this.groups.filter(function (group) { return group.expanded === false; }).map(function (group) { return group.id; });
1126
- this.groupsMap = {};
1127
- this.groups = [];
1128
- this.originGroups.forEach(function (origin) {
1129
- var group = new GanttGroupInternal(origin);
1130
- group.expanded = !collapsedIds.includes(group.id);
1131
- _this.groupsMap[group.id] = group;
1132
- _this.groups.push(group);
1133
- });
1134
- };
1135
- GanttUpper.prototype.setupItems = function () {
1136
- var _this = this;
1137
- this.items = [];
1138
- this.originItems = uniqBy(this.originItems, 'id');
1139
- // 根据上一次数据展开状态同步新的数据展开状态
1140
- this.originItems.forEach(function (item) {
1141
- if (!_this.firstChange) {
1142
- item.expanded = item.expanded || _this.expandedItemIds.includes(item.id);
1143
- }
1144
- });
1145
- if (this.groups.length > 0) {
1146
- this.originItems.forEach(function (origin) {
1147
- var group = _this.groupsMap[origin.group_id];
1148
- if (group) {
1149
- var item = new GanttItemInternal(origin, { viewType: _this.viewType });
1150
- group.items.push(item);
1151
- }
1152
- });
1153
- }
1154
- else {
1155
- this.originItems.forEach(function (origin) {
1156
- var item = new GanttItemInternal(origin, { viewType: _this.viewType });
1157
- _this.items.push(item);
1158
- });
1159
- }
1160
- };
1161
- GanttUpper.prototype.setupExpandedState = function () {
1162
- var _this = this;
1163
- var items = [];
1164
- if (this.items.length > 0) {
1165
- items = recursiveItems(this.items);
1166
- }
1167
- else {
1168
- items = flatten(this.groups.map(function (group) { return recursiveItems(group.items); }));
1169
- }
1170
- this.expandedItemIds = [];
1171
- items.forEach(function (item) {
1172
- if (item.origin.expanded) {
1173
- _this.expandedItemIds.push(item.id);
1174
- }
1175
- });
1176
- };
1177
- GanttUpper.prototype.getViewDate = function () {
1178
- var _this = this;
1179
- var start = this.start;
1180
- var end = this.end;
1181
- if (!this.start || !this.end) {
1182
- this.originItems.forEach(function (item) {
1183
- if (item.start && !_this.start) {
1184
- start = start ? Math.min(start, item.start) : item.start;
1185
- }
1186
- if (item.end && !_this.end) {
1187
- end = end ? Math.max(end, item.end) : item.end;
1188
- }
1189
- });
1190
- }
1191
- return {
1192
- start: {
1193
- date: new GanttDate(start),
1194
- isCustom: this.start ? true : false
1195
- },
1196
- end: {
1197
- date: new GanttDate(end),
1198
- isCustom: this.end ? true : false
1199
- }
1200
- };
1201
- };
1202
- GanttUpper.prototype.computeRefs = function () {
1203
- var _this = this;
1204
- this.groups.forEach(function (group) {
1205
- var groupItems = recursiveItems(group.items);
1206
- _this.computeItemsRefs.apply(_this, __spread(groupItems));
1207
- });
1208
- var items = recursiveItems(this.items);
1209
- this.computeItemsRefs.apply(this, __spread(items));
1210
- };
1211
- GanttUpper.prototype.expandGroups = function (expanded) {
1212
- this.groups.forEach(function (group) {
1213
- group.setExpand(expanded);
1214
- });
1215
- this.expandChange.next();
1216
- this.cdr.detectChanges();
1217
- };
1218
- GanttUpper.prototype.onInit = function () {
1219
- var _this = this;
1220
- this.styles = Object.assign({}, defaultStyles, this.styles);
1221
- this.createView();
1222
- this.setupGroups();
1223
- this.setupItems();
1224
- this.computeRefs();
1225
- this.firstChange = false;
1226
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
1227
- _this.element.style.opacity = '1';
1228
- _this.dragContainer.dragStarted.subscribe(function (event) {
1229
- _this.dragStarted.emit(event);
1230
- });
1231
- _this.dragContainer.dragEnded.subscribe(function (event) {
1232
- _this.dragEnded.emit(event);
1233
- _this.computeRefs();
1234
- _this.detectChanges();
1235
- });
1236
- });
1237
- this.view.start$.pipe(operators.skip(1), operators.takeUntil(this.unsubscribe$)).subscribe(function () {
1238
- _this.computeRefs();
1239
- });
1240
- };
1241
- GanttUpper.prototype.onChanges = function (changes) {
1242
- if (!this.firstChange) {
1243
- if (changes.viewType && changes.viewType.currentValue) {
1244
- this.createView();
1245
- this.setupGroups();
1246
- this.setupItems();
1247
- this.computeRefs();
1248
- this.viewChange.emit(this.view);
1249
- }
1250
- if (changes.originItems || changes.originGroups) {
1251
- this.setupExpandedState();
1252
- this.setupGroups();
1253
- this.setupItems();
1254
- this.computeRefs();
1255
- }
1256
- }
1257
- };
1258
- GanttUpper.prototype.onDestroy = function () {
1259
- this.unsubscribe$.next();
1260
- this.unsubscribe$.complete();
1261
- };
1262
- GanttUpper.prototype.computeItemsRefs = function () {
1263
- var _this = this;
1264
- var items = [];
1265
- for (var _i = 0; _i < arguments.length; _i++) {
1266
- items[_i] = arguments[_i];
1267
- }
1268
- items.forEach(function (item) {
1269
- item.updateRefs({
1270
- width: item.start && item.end ? _this.view.getDateRangeWidth(item.start.startOfDay(), item.end.endOfDay()) : 0,
1271
- x: item.start ? _this.view.getXPointByDate(item.start) : 0,
1272
- y: (_this.styles.lineHeight - _this.styles.barHeight) / 2 - 1
1273
- });
1274
- });
1275
- };
1276
- GanttUpper.prototype.trackBy = function (item, index) {
1277
- return item.id || index;
1278
- };
1279
- GanttUpper.prototype.detectChanges = function () {
1280
- this.cdr.detectChanges();
1281
- };
1282
- GanttUpper.prototype.expandGroup = function (group) {
1283
- group.setExpand(!group.expanded);
1284
- this.expandChange.emit();
1285
- this.cdr.detectChanges();
1286
- };
1287
- // public functions
1288
- GanttUpper.prototype.expandAll = function () {
1289
- this.expandGroups(true);
1290
- };
1291
- GanttUpper.prototype.collapseAll = function () {
1292
- this.expandGroups(false);
1293
- };
1294
- return GanttUpper;
1295
- }());
1296
- GanttUpper.decorators = [
1297
- { type: core.Directive }
1298
- ];
1299
- GanttUpper.ctorParameters = function () { return [
1300
- { type: core.ElementRef },
1301
- { type: core.ChangeDetectorRef },
1302
- { type: core.NgZone }
1303
- ]; };
1304
- GanttUpper.propDecorators = {
1305
- originItems: [{ type: core.Input, args: ['items',] }],
1306
- originGroups: [{ type: core.Input, args: ['groups',] }],
1307
- viewType: [{ type: core.Input }],
1308
- start: [{ type: core.Input }],
1309
- end: [{ type: core.Input }],
1310
- showTodayLine: [{ type: core.Input }],
1311
- draggable: [{ type: core.Input }],
1312
- styles: [{ type: core.Input }],
1313
- viewOptions: [{ type: core.Input }],
1314
- disabledLoadOnScroll: [{ type: core.Input }],
1315
- loadOnScroll: [{ type: core.Output }],
1316
- dragStarted: [{ type: core.Output }],
1317
- dragEnded: [{ type: core.Output }],
1318
- barClick: [{ type: core.Output }],
1319
- barTemplate: [{ type: core.ContentChild, args: ['bar', { static: true },] }],
1320
- rangeTemplate: [{ type: core.ContentChild, args: ['range', { static: true },] }],
1321
- itemTemplate: [{ type: core.ContentChild, args: ['item', { static: true },] }],
1322
- groupTemplate: [{ type: core.ContentChild, args: ['group', { static: true },] }],
1323
- groupHeaderTemplate: [{ type: core.ContentChild, args: ['groupHeader', { static: true },] }],
1324
- ganttClass: [{ type: core.HostBinding, args: ['class.gantt',] }]
1325
- };
1326
- var GANTT_UPPER_TOKEN = new core.InjectionToken('GANTT_UPPER_TOKEN');
1327
-
1328
- var NgxGanttTableColumnComponent = /** @class */ (function () {
1329
- function NgxGanttTableColumnComponent(ganttUpper) {
1330
- this.ganttUpper = ganttUpper;
1331
- }
1332
- Object.defineProperty(NgxGanttTableColumnComponent.prototype, "width", {
1333
- set: function (width) {
1334
- this.columnWidth = coercion.coerceCssPixelValue(width);
1335
- },
1336
- enumerable: false,
1337
- configurable: true
1338
- });
1339
- NgxGanttTableColumnComponent.prototype.ngOnInit = function () { };
1340
- return NgxGanttTableColumnComponent;
1341
- }());
1342
- NgxGanttTableColumnComponent.decorators = [
1343
- { type: core.Component, args: [{
1344
- selector: 'ngx-gantt-column',
1345
- template: ''
1346
- },] }
1347
- ];
1348
- NgxGanttTableColumnComponent.ctorParameters = function () { return [
1349
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] }
1350
- ]; };
1351
- NgxGanttTableColumnComponent.propDecorators = {
1352
- width: [{ type: core.Input }],
1353
- name: [{ type: core.Input }],
1354
- templateRef: [{ type: core.ContentChild, args: ['cell', { static: true },] }],
1355
- headerTemplateRef: [{ type: core.ContentChild, args: ['header', { static: true },] }]
1356
- };
1357
-
1358
- var NgxGanttTableComponent = /** @class */ (function () {
1359
- function NgxGanttTableComponent() {
1360
- this.columnChanges = new core.EventEmitter();
1361
- }
1362
- NgxGanttTableComponent.prototype.ngOnInit = function () { };
1363
- return NgxGanttTableComponent;
1364
- }());
1365
- NgxGanttTableComponent.decorators = [
1366
- { type: core.Component, args: [{
1367
- selector: 'ngx-gantt-table',
1368
- template: ''
1369
- },] }
1370
- ];
1371
- NgxGanttTableComponent.ctorParameters = function () { return []; };
1372
- NgxGanttTableComponent.propDecorators = {
1373
- columnChanges: [{ type: core.Output }]
1374
- };
1375
-
1376
- var defaultColumnWidth = 100;
1377
- var minColumnWidth = 80;
1378
- var NgxGanttComponent = /** @class */ (function (_super) {
1379
- __extends(NgxGanttComponent, _super);
1380
- function NgxGanttComponent(elementRef, cdr, ngZone) {
1381
- var _this = _super.call(this, elementRef, cdr, ngZone) || this;
1382
- _this.maxLevel = 2;
1383
- _this.linkDragStarted = new core.EventEmitter();
1384
- _this.linkDragEnded = new core.EventEmitter();
1385
- _this.lineClick = new core.EventEmitter();
1386
- _this.ngUnsubscribe$ = new rxjs.Subject();
1387
- _this.sideTableWidth = sideWidth;
1388
- return _this;
1389
- }
1390
- NgxGanttComponent.prototype.ngOnInit = function () {
1391
- var _this = this;
1392
- _super.prototype.onInit.call(this);
1393
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
1394
- _this.dragContainer.linkDragStarted.pipe(operators.takeUntil(_this.ngUnsubscribe$)).subscribe(function (event) {
1395
- _this.linkDragStarted.emit(event);
1396
- });
1397
- _this.dragContainer.linkDragEnded.pipe(operators.takeUntil(_this.ngUnsubscribe$)).subscribe(function (event) {
1398
- _this.linkDragEnded.emit(event);
1399
- });
1400
- });
1401
- };
1402
- NgxGanttComponent.prototype.ngAfterViewInit = function () {
1403
- var _this = this;
1404
- this.columns.changes.pipe(operators.startWith(true), operators.takeUntil(this.ngUnsubscribe$)).subscribe(function () {
1405
- _this.columns.forEach(function (column) {
1406
- if (!column.columnWidth) {
1407
- column.columnWidth = coercion.coerceCssPixelValue(defaultColumnWidth);
1408
- }
1409
- });
1410
- _this.cdr.detectChanges();
1411
- });
1412
- };
1413
- NgxGanttComponent.prototype.ngOnChanges = function (changes) {
1414
- _super.prototype.onChanges.call(this, changes);
1415
- };
1416
- NgxGanttComponent.prototype.expandChildren = function (item) {
1417
- var _this = this;
1418
- if (!item.expanded) {
1419
- item.setExpand(true);
1420
- if (this.async && this.childrenResolve && item.children.length === 0) {
1421
- item.loading = true;
1422
- this.childrenResolve(item.origin)
1423
- .pipe(operators.take(1), operators.finalize(function () {
1424
- item.loading = false;
1425
- _this.expandChange.emit();
1426
- _this.cdr.detectChanges();
1427
- }))
1428
- .subscribe(function (items) {
1429
- item.addChildren(items);
1430
- _this.computeItemsRefs.apply(_this, __spread(item.children));
1431
- });
1432
- }
1433
- else {
1434
- this.computeItemsRefs.apply(this, __spread(item.children));
1435
- this.expandChange.emit();
1436
- }
1437
- }
1438
- else {
1439
- item.setExpand(false);
1440
- this.expandChange.emit();
1441
- }
1442
- };
1443
- NgxGanttComponent.prototype.ngOnDestroy = function () {
1444
- _super.prototype.onDestroy.call(this);
1445
- };
1446
- return NgxGanttComponent;
1447
- }(GanttUpper));
1448
- NgxGanttComponent.decorators = [
1449
- { type: core.Component, args: [{
1450
- selector: 'ngx-gantt',
1451
- template: "<ngx-gantt-root>\n <ng-template #sideTemplate>\n <gantt-table [groups]=\"groups\" [items]=\"items\" [columns]=\"columns\" [groupTemplate]=\"groupTemplate\" [emptyTemplate]=\"tableEmptyTemplate\"></gantt-table>\n </ng-template>\n <ng-template #mainTemplate>\n <gantt-main\n [groups]=\"groups\"\n [items]=\"items\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </ng-template>\n</ngx-gantt-root>\n",
1452
- changeDetection: core.ChangeDetectionStrategy.OnPush,
1453
- providers: [
1454
- {
1455
- provide: GANTT_UPPER_TOKEN,
1456
- useExisting: NgxGanttComponent
1457
- }
1458
- ]
1459
- },] }
1460
- ];
1461
- NgxGanttComponent.ctorParameters = function () { return [
1462
- { type: core.ElementRef },
1463
- { type: core.ChangeDetectorRef },
1464
- { type: core.NgZone }
1465
- ]; };
1466
- NgxGanttComponent.propDecorators = {
1467
- maxLevel: [{ type: core.Input }],
1468
- async: [{ type: core.Input }],
1469
- childrenResolve: [{ type: core.Input }],
1470
- linkable: [{ type: core.Input }],
1471
- linkDragStarted: [{ type: core.Output }],
1472
- linkDragEnded: [{ type: core.Output }],
1473
- lineClick: [{ type: core.Output }],
1474
- table: [{ type: core.ContentChild, args: [NgxGanttTableComponent,] }],
1475
- columns: [{ type: core.ContentChildren, args: [NgxGanttTableColumnComponent, { descendants: true },] }],
1476
- tableEmptyTemplate: [{ type: core.ContentChild, args: ['tableEmpty', { static: true },] }]
1477
- };
1478
-
1479
- var mainHeight = 5000;
1480
- var GanttCalendarComponent = /** @class */ (function () {
1481
- function GanttCalendarComponent(ganttUpper, ngZone, elementRef) {
1482
- this.ganttUpper = ganttUpper;
1483
- this.ngZone = ngZone;
1484
- this.elementRef = elementRef;
1485
- this.unsubscribe$ = new rxjs.Subject();
1486
- this.headerHeight = headerHeight;
1487
- this.mainHeight = mainHeight;
1488
- this.todayHeight = todayHeight;
1489
- this.todayWidth = todayWidth;
1490
- this.todayBorderRadius = todayBorderRadius;
1491
- this.viewTypes = exports.GanttViewType;
1492
- this.className = true;
1493
- }
1494
- Object.defineProperty(GanttCalendarComponent.prototype, "view", {
1495
- get: function () {
1496
- return this.ganttUpper.view;
1497
- },
1498
- enumerable: false,
1499
- configurable: true
1500
- });
1501
- GanttCalendarComponent.prototype.setTodayPoint = function () {
1502
- var x = this.view.getTodayXPoint();
1503
- var today = new GanttDate().getDate();
1504
- var todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
1505
- var rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
1506
- var line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
1507
- if (isNumber(x)) {
1508
- if (rect) {
1509
- rect.style.left = x - todayWidth / 2 + "px";
1510
- rect.style.top = headerHeight - todayHeight + "px";
1511
- rect.innerHTML = today.toString();
1512
- }
1513
- if (line) {
1514
- line.style.left = x + "px";
1515
- line.style.top = headerHeight + "px";
1516
- line.style.bottom = -mainHeight + "px";
1517
- }
1518
- }
1519
- else {
1520
- todayEle.style.display = 'none';
1521
- }
1522
- };
1523
- GanttCalendarComponent.prototype.ngOnInit = function () {
1524
- var _this = this;
1525
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
1526
- rxjs.merge(_this.ganttUpper.viewChange, _this.ganttUpper.view.start$)
1527
- .pipe(operators.takeUntil(_this.unsubscribe$))
1528
- .subscribe(function () {
1529
- _this.setTodayPoint();
1530
- });
1531
- });
1532
- };
1533
- GanttCalendarComponent.prototype.ngAfterViewInit = function () { };
1534
- GanttCalendarComponent.prototype.ngOnChanges = function (changes) { };
1535
- GanttCalendarComponent.prototype.trackBy = function (point, index) {
1536
- return point.text || index;
1537
- };
1538
- GanttCalendarComponent.prototype.ngOnDestroy = function () {
1539
- this.unsubscribe$.next();
1540
- this.unsubscribe$.complete();
1541
- };
1542
- return GanttCalendarComponent;
1543
- }());
1544
- GanttCalendarComponent.decorators = [
1545
- { type: core.Component, args: [{
1546
- selector: 'gantt-calendar-overlay',
1547
- template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-overlay-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text class=\"primary-text\" *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text class=\"secondary-text\" [class.secondary-text-weekend]=\"point.additions?.isWeekend\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n </ng-container>\n\n <g>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n\n <g>\n <line [attr.x1]=\"0\" [attr.x2]=\"view.width\" [attr.y1]=\"headerHeight\" [attr.y2]=\"headerHeight\" class=\"header-line\"></line>\n </g>\n </g>\n <g>\n <g *ngIf=\"view.showTimeline\">\n <line\n *ngFor=\"let point of view.secondaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.cellWidth\"\n [attr.x2]=\"(i + 1) * view.cellWidth\"\n [attr.y1]=\"headerHeight\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n </g>\n</svg>\n"
1548
- },] }
1549
- ];
1550
- GanttCalendarComponent.ctorParameters = function () { return [
1551
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] },
1552
- { type: core.NgZone },
1553
- { type: core.ElementRef }
1554
- ]; };
1555
- GanttCalendarComponent.propDecorators = {
1556
- className: [{ type: core.HostBinding, args: ['class.gantt-calendar-overlay',] }]
1557
- };
1558
-
1559
- var GanttTableComponent = /** @class */ (function () {
1560
- function GanttTableComponent(gantt, elementRef) {
1561
- this.gantt = gantt;
1562
- this.elementRef = elementRef;
1563
- this.ganttTableClass = true;
1564
- this.ganttTableEmptyClass = false;
1565
- }
1566
- Object.defineProperty(GanttTableComponent.prototype, "columns", {
1567
- set: function (columns) {
1568
- columns.forEach(function (column) {
1569
- if (!column.columnWidth) {
1570
- column.columnWidth = coercion.coerceCssPixelValue(defaultColumnWidth);
1571
- }
1572
- });
1573
- this.columnList = columns;
1574
- },
1575
- enumerable: false,
1576
- configurable: true
1577
- });
1578
- GanttTableComponent.prototype.ngOnInit = function () { };
1579
- GanttTableComponent.prototype.ngOnChanges = function (changes) {
1580
- var _a, _b;
1581
- if (!((_a = changes.groups.currentValue) === null || _a === void 0 ? void 0 : _a.length) && !((_b = changes.items.currentValue) === null || _b === void 0 ? void 0 : _b.length)) {
1582
- this.ganttTableEmptyClass = true;
1583
- }
1584
- else {
1585
- this.ganttTableEmptyClass = false;
1586
- }
1587
- };
1588
- GanttTableComponent.prototype.dragFixed = function (config) {
1589
- if (config.movedWidth < config.minWidth) {
1590
- config.target.style.transform = "translate3d(" + (config.minWidth - config.originWidth) + "px, 0, 0)";
1591
- }
1592
- };
1593
- GanttTableComponent.prototype.expandGroup = function (group) {
1594
- this.gantt.expandGroup(group);
1595
- };
1596
- GanttTableComponent.prototype.expandChildren = function (item) {
1597
- this.gantt.expandChildren(item);
1598
- };
1599
- GanttTableComponent.prototype.dragStarted = function (event) {
1600
- var target = event.source.element.nativeElement;
1601
- this.dragStartLeft = target.getBoundingClientRect().left;
1602
- };
1603
- GanttTableComponent.prototype.dragMoved = function (event, column) {
1604
- var target = event.source.element.nativeElement;
1605
- var left = target.getBoundingClientRect().left;
1606
- var originWidth;
1607
- var movedWidth;
1608
- var minWidth;
1609
- if (column) {
1610
- originWidth = parseInt(column.columnWidth, 10);
1611
- movedWidth = originWidth + (left - this.dragStartLeft);
1612
- minWidth = minColumnWidth;
1613
- }
1614
- else {
1615
- originWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
1616
- movedWidth = originWidth + (left - this.dragStartLeft);
1617
- minWidth = minColumnWidth * this.columnList.length;
1618
- }
1619
- this.dragFixed({
1620
- target: target,
1621
- originWidth: originWidth,
1622
- movedWidth: movedWidth,
1623
- minWidth: minWidth
1624
- });
1625
- this.showAuxiliaryLine(event);
1626
- };
1627
- GanttTableComponent.prototype.columnDragEnded = function (event, column) {
1628
- var target = event.source.element.nativeElement;
1629
- var left = target.getBoundingClientRect().left;
1630
- var width = parseInt(column.columnWidth, 10) + (left - this.dragStartLeft);
1631
- var columnWidth = Math.max(width || 0, minColumnWidth);
1632
- column.columnWidth = coercion.coerceCssPixelValue(columnWidth);
1633
- if (this.gantt.table) {
1634
- this.gantt.table.columnChanges.emit({ columns: this.columnList });
1635
- }
1636
- this.hideAuxiliaryLine();
1637
- event.source.reset();
1638
- };
1639
- GanttTableComponent.prototype.tableDragEnded = function (event) {
1640
- var target = event.source.element.nativeElement;
1641
- var left = target.getBoundingClientRect().left;
1642
- var tableWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
1643
- var dragWidth = left - this.dragStartLeft;
1644
- this.columnList.forEach(function (column) {
1645
- var lastColumnWidth = parseInt(column.columnWidth, 10);
1646
- var distributeWidth = parseInt(String(dragWidth * (lastColumnWidth / tableWidth)), 10);
1647
- var columnWidth = Math.max(lastColumnWidth + distributeWidth || 0, minColumnWidth);
1648
- column.columnWidth = coercion.coerceCssPixelValue(columnWidth);
1649
- });
1650
- if (this.gantt.table) {
1651
- this.gantt.table.columnChanges.emit({ columns: this.columnList });
1652
- }
1653
- this.hideAuxiliaryLine();
1654
- event.source.reset();
1655
- };
1656
- GanttTableComponent.prototype.showAuxiliaryLine = function (event) {
1657
- var tableRect = this.elementRef.nativeElement.getBoundingClientRect();
1658
- var targetRect = event.source.element.nativeElement.getBoundingClientRect();
1659
- var distance = { x: targetRect.left - tableRect.left, y: targetRect.top - tableRect.top };
1660
- this.draglineElementRef.nativeElement.style.left = distance.x + "px";
1661
- this.draglineElementRef.nativeElement.style.display = 'block';
1662
- };
1663
- GanttTableComponent.prototype.hideAuxiliaryLine = function () {
1664
- this.draglineElementRef.nativeElement.style.display = 'none';
1665
- };
1666
- return GanttTableComponent;
1667
- }());
1668
- GanttTableComponent.decorators = [
1669
- { type: core.Component, args: [{
1670
- selector: 'gantt-table',
1671
- template: "<div class=\"gantt-table-header gantt-table-row\">\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let i = index\" [style.width]=\"column.columnWidth\">\n <ng-container *ngIf=\"column.headerTemplateRef; else default\" [ngTemplateOutlet]=\"column.headerTemplateRef\"></ng-container>\n <ng-template #default>\n {{ column.name }}\n </ng-template>\n <div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event, column)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"columnDragEnded($event, column)\"\n ></div>\n </div>\n</div>\n<div class=\"gantt-table-body\">\n <ng-container *ngIf=\"!groups.length && !items.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"groups && groups.length > 0; else itemsTemplate\">\n <ng-container *ngFor=\"let group of groups\">\n <div class=\"gantt-table-group\" [ngClass]=\"group.class\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"group.expanded\" (click)=\"expandGroup(group)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"group.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.origin, group: group.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ group.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <ng-container *ngIf=\"group.expanded\">\n <ng-template\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ group: group, items: group.items, level: 0 }\"\n ></ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"tableDragEnded($event)\"\n></div>\n\n<div #dragLine class=\"gantt-table-drag-auxiliary-line\"></div>\n\n<ng-template #itemsTemplate>\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items, level: 0 }\"></ng-template>\n</ng-template>\n\n<ng-template #ganttItems let-group=\"group\" let-items=\"items\" let-level=\"level\">\n <ng-container *ngFor=\"let item of items\">\n <div\n class=\"gantt-table-item gantt-table-row\"\n [class.gantt-table-item-first-level-group]=\"level === 0 && (item.type | isGanttRangeItem)\"\n [class.gantt-table-item-with-group]=\"group\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n >\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let first = first\" [style.width]=\"column.columnWidth\">\n <div *ngIf=\"first\" class=\"gantt-expand-icon\" [style.marginLeft.px]=\"level * 20\">\n <ng-container *ngIf=\"level < gantt.maxLevel - 1 && item.expandable\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren(item)\"\n ></gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children, level: level + 1, group: group }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n"
1672
- },] }
1673
- ];
1674
- GanttTableComponent.ctorParameters = function () { return [
1675
- { type: NgxGanttComponent },
1676
- { type: core.ElementRef }
1677
- ]; };
1678
- GanttTableComponent.propDecorators = {
1679
- groups: [{ type: core.Input }],
1680
- items: [{ type: core.Input }],
1681
- columns: [{ type: core.Input }],
1682
- groupTemplate: [{ type: core.Input }],
1683
- emptyTemplate: [{ type: core.Input }],
1684
- draglineElementRef: [{ type: core.ViewChild, args: ['dragLine', { static: true },] }],
1685
- ganttTableClass: [{ type: core.HostBinding, args: ['class.gantt-table',] }],
1686
- ganttTableEmptyClass: [{ type: core.HostBinding, args: ['class.gantt-table-empty',] }]
1687
- };
1688
-
1689
- var scrollThreshold = 50;
1690
- var ScrollDirection;
1691
- (function (ScrollDirection) {
1692
- ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1693
- ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1694
- ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1695
- })(ScrollDirection || (ScrollDirection = {}));
1696
- var GanttDomService = /** @class */ (function () {
1697
- function GanttDomService() {
1698
- this.unsubscribe$ = new rxjs.Subject();
1699
- }
1700
- GanttDomService.prototype.monitorScrollChange = function () {
1701
- var _this = this;
1702
- rxjs.merge(rxjs.fromEvent(this.mainContainer, 'scroll'), rxjs.fromEvent(this.sideContainer, 'scroll'))
1703
- .pipe(operators.takeUntil(this.unsubscribe$))
1704
- .subscribe(function (event) {
1705
- _this.syncScroll(event);
1706
- });
1707
- rxjs.fromEvent(this.mainContainer, 'scroll')
1708
- .pipe(operators.startWith(), operators.takeUntil(this.unsubscribe$))
1709
- .subscribe(function (event) {
1710
- // if (this.mainContainer.scrollLeft > 0) {
1711
- // this.side.classList.add('gantt-side-has-shadow');
1712
- // } else {
1713
- // this.side.classList.remove('gantt-side-has-shadow');
1714
- // }
1715
- });
1716
- };
1717
- GanttDomService.prototype.syncScroll = function (event) {
1718
- var target = event.currentTarget;
1719
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1720
- this.sideContainer.scrollTop = target.scrollTop;
1721
- this.mainContainer.scrollTop = target.scrollTop;
1722
- };
1723
- GanttDomService.prototype.disableBrowserWheelEvent = function () {
1724
- var container = this.mainContainer;
1725
- rxjs.fromEvent(container, 'wheel')
1726
- .pipe(operators.takeUntil(this.unsubscribe$))
1727
- .subscribe(function (event) {
1728
- var delta = event.deltaX;
1729
- if (!delta) {
1730
- return;
1731
- }
1732
- if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1733
- (container.scrollLeft === 0 && delta < 0)) {
1734
- event.preventDefault();
1735
- }
1736
- });
1737
- };
1738
- GanttDomService.prototype.initialize = function (root) {
1739
- this.root = root.nativeElement;
1740
- this.side = this.root.getElementsByClassName('gantt-side')[0];
1741
- this.container = this.root.getElementsByClassName('gantt-container')[0];
1742
- this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
1743
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1744
- this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-overlay')[0];
1745
- this.monitorScrollChange();
1746
- this.disableBrowserWheelEvent();
1747
- };
1748
- GanttDomService.prototype.getViewerScroll = function () {
1749
- var _this = this;
1750
- return rxjs.fromEvent(this.mainContainer, 'scroll').pipe(operators.map(function () { return _this.mainContainer.scrollLeft; }), operators.pairwise(), operators.map(function (_a) {
1751
- var _b = __read(_a, 2), previous = _b[0], current = _b[1];
1752
- var event = {
1753
- target: _this.mainContainer,
1754
- direction: ScrollDirection.NONE
1755
- };
1756
- if (current - previous < 0) {
1757
- if (_this.mainContainer.scrollLeft < scrollThreshold && _this.mainContainer.scrollLeft > 0) {
1758
- event.direction = ScrollDirection.LEFT;
1759
- }
1760
- }
1761
- if (current - previous > 0) {
1762
- if (_this.mainContainer.scrollWidth - _this.mainContainer.clientWidth - _this.mainContainer.scrollLeft < scrollThreshold) {
1763
- event.direction = ScrollDirection.RIGHT;
1764
- }
1765
- }
1766
- return event;
1767
- }));
1768
- };
1769
- GanttDomService.prototype.getResize = function () {
1770
- return rxjs.fromEvent(window, 'resize').pipe(operators.auditTime(150));
1771
- };
1772
- GanttDomService.prototype.scrollMainContainer = function (left) {
1773
- if (isNumber(left)) {
1774
- var scrollLeft = left - this.mainContainer.clientWidth / 2;
1775
- this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
1776
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1777
- }
1778
- };
1779
- GanttDomService.prototype.ngOnDestroy = function () {
1780
- this.unsubscribe$.next();
1781
- this.unsubscribe$.complete();
1782
- };
1783
- return GanttDomService;
1784
- }());
1785
- GanttDomService.decorators = [
1786
- { type: core.Injectable }
1787
- ];
1788
- GanttDomService.ctorParameters = function () { return []; };
1789
-
1790
- var GanttDragContainer = /** @class */ (function () {
1791
- function GanttDragContainer() {
1792
- this.dragStarted = new core.EventEmitter();
1793
- this.dragEnded = new core.EventEmitter();
1794
- this.linkDragStarted = new core.EventEmitter();
1795
- this.linkDragEntered = new core.EventEmitter();
1796
- this.linkDragEnded = new core.EventEmitter();
1797
- }
1798
- GanttDragContainer.prototype.emitLinkDragStarted = function (from, item) {
1799
- this.linkDraggingId = item.id;
1800
- this.linkDragFrom = from;
1801
- this.linkDragSource = this.linkDragFrom === 'source' ? item : null;
1802
- this.linkDragTarget = this.linkDragFrom === 'target' ? item : null;
1803
- this.linkDragStarted.emit({
1804
- source: this.linkDragSource && this.linkDragSource.origin,
1805
- target: this.linkDragTarget && this.linkDragTarget.origin
1806
- });
1807
- };
1808
- GanttDragContainer.prototype.emitLinkDragEntered = function (item) {
1809
- if (this.linkDragFrom === 'source') {
1810
- this.linkDragTarget = item;
1811
- }
1812
- else {
1813
- this.linkDragSource = item;
1814
- }
1815
- this.linkDragEntered.emit({
1816
- source: this.linkDragSource.origin,
1817
- target: this.linkDragTarget.origin
1818
- });
1819
- };
1820
- GanttDragContainer.prototype.emitLinkDragLeaved = function () {
1821
- if (this.linkDragFrom === 'source') {
1822
- this.linkDragTarget = null;
1823
- }
1824
- else {
1825
- this.linkDragSource = null;
1826
- }
1827
- };
1828
- GanttDragContainer.prototype.emitLinkDragEnded = function () {
1829
- this.linkDraggingId = null;
1830
- if (this.linkDragSource && this.linkDragTarget) {
1831
- this.linkDragSource.addLink(this.linkDragTarget.id);
1832
- this.linkDragEnded.emit({
1833
- source: this.linkDragSource.origin,
1834
- target: this.linkDragTarget.origin
1835
- });
1836
- }
1837
- this.linkDragSource = null;
1838
- this.linkDragTarget = null;
1839
- };
1840
- return GanttDragContainer;
1841
- }());
1842
- GanttDragContainer.decorators = [
1843
- { type: core.Injectable }
1844
- ];
1845
- GanttDragContainer.ctorParameters = function () { return []; };
1846
-
1847
- var dragMinWidth = 10;
1848
- var activeClass = 'gantt-bar-active';
1849
- var linkDropClass = 'gantt-bar-link-drop';
1850
- function createSvgElement(qualifiedName, className) {
1851
- var element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
1852
- element.classList.add(className);
1853
- return element;
1854
- }
1855
- var GanttBarDrag = /** @class */ (function () {
1856
- function GanttBarDrag(dragDrop, dom, dragContainer) {
1857
- this.dragDrop = dragDrop;
1858
- this.dom = dom;
1859
- this.dragContainer = dragContainer;
1860
- this.dragRefs = [];
1861
- this.destroy$ = new rxjs.Subject();
1862
- }
1863
- Object.defineProperty(GanttBarDrag.prototype, "dragDisabled", {
1864
- get: function () {
1865
- return !this.item.draggable || !this.ganttUpper.draggable;
1866
- },
1867
- enumerable: false,
1868
- configurable: true
1869
- });
1870
- Object.defineProperty(GanttBarDrag.prototype, "linkDragDisabled", {
1871
- get: function () {
1872
- return !this.item.linkable || !this.ganttUpper.linkable;
1873
- },
1874
- enumerable: false,
1875
- configurable: true
1876
- });
1877
- GanttBarDrag.prototype.createMouseEvents = function () {
1878
- var _this = this;
1879
- rxjs.fromEvent(this.barElement, 'mouseenter')
1880
- .pipe(operators.takeUntil(this.destroy$))
1881
- .subscribe(function () {
1882
- if (_this.dragContainer.linkDraggingId && _this.dragContainer.linkDraggingId !== _this.item.id) {
1883
- if (_this.item.linkable) {
1884
- _this.barElement.classList.add(linkDropClass);
1885
- _this.dragContainer.emitLinkDragEntered(_this.item);
1886
- }
1887
- }
1888
- else {
1889
- _this.barElement.classList.add(activeClass);
1890
- }
1891
- });
1892
- rxjs.fromEvent(this.barElement, 'mouseleave')
1893
- .pipe(operators.takeUntil(this.destroy$))
1894
- .subscribe(function () {
1895
- if (!_this.dragContainer.linkDraggingId) {
1896
- _this.barElement.classList.remove(activeClass);
1897
- }
1898
- else {
1899
- _this.dragContainer.emitLinkDragLeaved();
1900
- }
1901
- _this.barElement.classList.remove(linkDropClass);
1902
- });
1903
- };
1904
- GanttBarDrag.prototype.createBarDrag = function () {
1905
- var _this = this;
1906
- var dragRef = this.dragDrop.createDrag(this.barElement);
1907
- dragRef.lockAxis = 'x';
1908
- dragRef.started.subscribe(function () {
1909
- _this.setDraggingStyles();
1910
- _this.dragContainer.dragStarted.emit({ item: _this.item.origin });
1911
- });
1912
- dragRef.moved.subscribe(function (event) {
1913
- var x = _this.item.refs.x + event.distance.x;
1914
- var days = dateFns.differenceInCalendarDays(_this.item.end.value, _this.item.start.value);
1915
- var start = _this.ganttUpper.view.getDateByXPoint(x);
1916
- var end = start.addDays(days);
1917
- _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), end);
1918
- });
1919
- dragRef.ended.subscribe(function (event) {
1920
- var days = dateFns.differenceInCalendarDays(_this.item.end.value, _this.item.start.value);
1921
- var start = _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + event.distance.x);
1922
- var end = start.addDays(days);
1923
- _this.item.updateDate(start, end);
1924
- _this.clearDraggingStyles();
1925
- _this.closeDragBackdrop();
1926
- event.source.reset();
1927
- _this.dragContainer.dragEnded.emit({ item: _this.item.origin });
1928
- });
1929
- this.barDragRef = dragRef;
1930
- return dragRef;
1931
- };
1932
- GanttBarDrag.prototype.createBarHandleDrags = function () {
1933
- var _this = this;
1934
- var dragRefs = [];
1935
- var handles = this.barElement.querySelectorAll('.drag-handles .handle');
1936
- handles.forEach(function (handle, index) {
1937
- var isBefore = index === 0;
1938
- var dragRef = _this.dragDrop.createDrag(handle);
1939
- dragRef.lockAxis = 'x';
1940
- dragRef.withBoundaryElement(_this.dom.root);
1941
- dragRef.started.subscribe(function () {
1942
- _this.setDraggingStyles();
1943
- _this.dragContainer.dragStarted.emit({ item: _this.item.origin });
1944
- });
1945
- dragRef.moved.subscribe(function (event) {
1946
- if (isBefore) {
1947
- var x = _this.item.refs.x + event.distance.x;
1948
- var width = _this.item.refs.width + event.distance.x * -1;
1949
- if (width > dragMinWidth) {
1950
- _this.barElement.style.width = width + 'px';
1951
- _this.barElement.style.left = x + 'px';
1952
- _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), _this.ganttUpper.view.getDateByXPoint(x + width));
1953
- }
1954
- }
1955
- else {
1956
- var width = _this.item.refs.width + event.distance.x;
1957
- if (width > dragMinWidth) {
1958
- _this.barElement.style.width = width + 'px';
1959
- _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x), _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + width));
1960
- }
1961
- }
1962
- event.source.reset();
1963
- });
1964
- dragRef.ended.subscribe(function (event) {
1965
- if (isBefore) {
1966
- var width = _this.item.refs.width + event.distance.x * -1;
1967
- if (width > dragMinWidth) {
1968
- _this.item.updateDate(_this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + event.distance.x), _this.item.end);
1969
- }
1970
- else {
1971
- _this.item.updateDate(_this.item.end.startOfDay(), _this.item.end);
1972
- }
1973
- }
1974
- else {
1975
- var width = _this.item.refs.width + event.distance.x;
1976
- if (width > dragMinWidth) {
1977
- _this.item.updateDate(_this.item.start, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + _this.item.refs.width + event.distance.x));
1978
- }
1979
- else {
1980
- _this.item.updateDate(_this.item.start, _this.item.start.endOfDay());
1981
- }
1982
- }
1983
- _this.clearDraggingStyles();
1984
- _this.closeDragBackdrop();
1985
- _this.dragContainer.dragEnded.emit({ item: _this.item.origin });
1986
- });
1987
- dragRefs.push(dragRef);
1988
- });
1989
- return dragRefs;
1990
- };
1991
- GanttBarDrag.prototype.createLinkHandleDrags = function () {
1992
- var _this = this;
1993
- var dragRefs = [];
1994
- var handles = this.barElement.querySelectorAll('.link-handles .handle');
1995
- handles.forEach(function (handle, index) {
1996
- var isBefore = index === 0;
1997
- var dragRef = _this.dragDrop.createDrag(handle);
1998
- dragRef.withBoundaryElement(_this.dom.root);
1999
- dragRef.beforeStarted.subscribe(function () {
2000
- handle.style.pointerEvents = 'none';
2001
- if (_this.barDragRef) {
2002
- _this.barDragRef.disabled = true;
2003
- }
2004
- _this.createLinkDraggingLine();
2005
- _this.dragContainer.emitLinkDragStarted(isBefore ? 'target' : 'source', _this.item);
2006
- });
2007
- dragRef.moved.subscribe(function () {
2008
- var positions = _this.calcLinkLinePositions(handle, isBefore);
2009
- _this.linkDraggingLine.setAttribute('x1', positions.x1.toString());
2010
- _this.linkDraggingLine.setAttribute('y1', positions.y1.toString());
2011
- _this.linkDraggingLine.setAttribute('x2', positions.x2.toString());
2012
- _this.linkDraggingLine.setAttribute('y2', positions.y2.toString());
2013
- });
2014
- dragRef.ended.subscribe(function (event) {
2015
- event.source.reset();
2016
- handle.style.pointerEvents = '';
2017
- if (_this.barDragRef) {
2018
- _this.barDragRef.disabled = false;
2019
- }
2020
- _this.barElement.classList.remove(activeClass);
2021
- _this.destroyLinkDraggingLine();
2022
- _this.dragContainer.emitLinkDragEnded();
2023
- });
2024
- dragRefs.push(dragRef);
2025
- });
2026
- return dragRefs;
2027
- };
2028
- GanttBarDrag.prototype.openDragBackdrop = function (dragElement, start, end) {
2029
- var dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
2030
- var dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
2031
- var rootRect = this.dom.root.getBoundingClientRect();
2032
- var dragRect = dragElement.getBoundingClientRect();
2033
- var left = dragRect.left - rootRect.left - this.dom.side.clientWidth;
2034
- var width = dragRect.right - dragRect.left;
2035
- dragMaskElement.style.left = left + 'px';
2036
- dragMaskElement.style.width = width + 'px';
2037
- dragMaskElement.querySelector('.start').innerHTML = start.format('MM-dd');
2038
- dragMaskElement.querySelector('.end').innerHTML = end.format('MM-dd');
2039
- dragMaskElement.style.display = 'block';
2040
- dragBackdropElement.style.display = 'block';
2041
- };
2042
- GanttBarDrag.prototype.closeDragBackdrop = function () {
2043
- var dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
2044
- var dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
2045
- dragMaskElement.style.display = 'none';
2046
- dragBackdropElement.style.display = 'none';
2047
- };
2048
- GanttBarDrag.prototype.setDraggingStyles = function () {
2049
- this.barElement.style.pointerEvents = 'none';
2050
- this.barElement.classList.add('gantt-bar-draggable-drag');
2051
- };
2052
- GanttBarDrag.prototype.clearDraggingStyles = function () {
2053
- this.barElement.style.pointerEvents = '';
2054
- this.barElement.classList.remove('gantt-bar-draggable-drag');
2055
- };
2056
- GanttBarDrag.prototype.calcLinkLinePositions = function (target, isBefore) {
2057
- var rootRect = this.dom.root.getBoundingClientRect();
2058
- var targetRect = target.getBoundingClientRect();
2059
- var layerRect = target.parentElement.parentElement.getBoundingClientRect();
2060
- return {
2061
- x1: layerRect.left + (isBefore ? 0 : layerRect.width) - rootRect.left,
2062
- y1: layerRect.top + layerRect.height / 2 - rootRect.top,
2063
- x2: targetRect.left - rootRect.left + targetRect.width / 2,
2064
- y2: targetRect.top - rootRect.top + targetRect.height / 2
2065
- };
2066
- };
2067
- GanttBarDrag.prototype.createLinkDraggingLine = function () {
2068
- if (!this.linkDraggingLine) {
2069
- var svgElement = createSvgElement('svg', 'gantt-link-drag-container');
2070
- var linElement = createSvgElement('line', 'link-dragging-line');
2071
- svgElement.appendChild(linElement);
2072
- this.dom.root.appendChild(svgElement);
2073
- this.linkDraggingLine = linElement;
2074
- }
2075
- };
2076
- GanttBarDrag.prototype.destroyLinkDraggingLine = function () {
2077
- if (this.linkDraggingLine) {
2078
- this.linkDraggingLine.parentElement.remove();
2079
- this.linkDraggingLine = null;
2080
- }
2081
- };
2082
- GanttBarDrag.prototype.createDrags = function (elementRef, item, ganttUpper) {
2083
- var _a, _b;
2084
- this.item = item;
2085
- this.barElement = elementRef.nativeElement;
2086
- this.ganttUpper = ganttUpper;
2087
- if (!item.draggable || (this.dragDisabled && this.linkDragDisabled)) {
2088
- return;
2089
- }
2090
- else {
2091
- this.createMouseEvents();
2092
- if (!this.dragDisabled) {
2093
- var dragRef = this.createBarDrag();
2094
- var dragHandlesRefs = this.createBarHandleDrags();
2095
- (_a = this.dragRefs).push.apply(_a, __spread([dragRef], dragHandlesRefs));
2096
- }
2097
- if (!this.linkDragDisabled) {
2098
- var linkDragRefs = this.createLinkHandleDrags();
2099
- (_b = this.dragRefs).push.apply(_b, __spread(linkDragRefs));
2100
- }
2101
- }
2102
- };
2103
- GanttBarDrag.prototype.ngOnDestroy = function () {
2104
- this.closeDragBackdrop();
2105
- this.dragRefs.forEach(function (dragRef) { return dragRef.dispose(); });
2106
- this.destroy$.next();
2107
- this.destroy$.complete();
2108
- };
2109
- return GanttBarDrag;
2110
- }());
2111
- GanttBarDrag.decorators = [
2112
- { type: core.Injectable }
2113
- ];
2114
- GanttBarDrag.ctorParameters = function () { return [
2115
- { type: dragDrop.DragDrop },
2116
- { type: GanttDomService },
2117
- { type: GanttDragContainer }
2118
- ]; };
2119
-
2120
- var GanttItemUpper = /** @class */ (function () {
2121
- function GanttItemUpper(elementRef, ganttUpper) {
2122
- this.elementRef = elementRef;
2123
- this.ganttUpper = ganttUpper;
2124
- this.firstChange = true;
2125
- this.unsubscribe$ = new rxjs.Subject();
2126
- }
2127
- GanttItemUpper.prototype.onInit = function () {
2128
- var _this = this;
2129
- this.firstChange = false;
2130
- this.item.refs$.pipe(operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2131
- _this.setPositions();
2132
- });
2133
- };
2134
- GanttItemUpper.prototype.onChanges = function () {
2135
- if (!this.firstChange) {
2136
- this.setPositions();
2137
- }
2138
- };
2139
- GanttItemUpper.prototype.setPositions = function () {
2140
- var itemElement = this.elementRef.nativeElement;
2141
- itemElement.style.left = this.item.refs.x + 'px';
2142
- itemElement.style.top = this.item.refs.y + 'px';
2143
- itemElement.style.width = this.item.refs.width + 'px';
2144
- if (this.item.type === exports.GanttItemType.bar) {
2145
- itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2146
- }
2147
- else if (this.item.type === exports.GanttItemType.range) {
2148
- itemElement.style.height = rangeHeight + 'px';
2149
- }
2150
- else {
2151
- }
2152
- };
2153
- GanttItemUpper.prototype.onDestroy = function () {
2154
- this.unsubscribe$.next();
2155
- this.unsubscribe$.complete();
2156
- };
2157
- return GanttItemUpper;
2158
- }());
2159
- GanttItemUpper.decorators = [
2160
- { type: core.Directive }
2161
- ];
2162
- GanttItemUpper.ctorParameters = function () { return [
2163
- { type: core.ElementRef },
2164
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] }
2165
- ]; };
2166
- GanttItemUpper.propDecorators = {
2167
- template: [{ type: core.Input }],
2168
- item: [{ type: core.Input }]
2169
- };
2170
-
2171
- function linearGradient(sideOrCorner, color, stop) {
2172
- return "linear-gradient(" + sideOrCorner + "," + color + " 0%," + stop + " 40%)";
2173
- }
2174
- var NgxGanttBarComponent = /** @class */ (function (_super) {
2175
- __extends(NgxGanttBarComponent, _super);
2176
- function NgxGanttBarComponent(dragContainer, drag, elementRef, ganttUpper) {
2177
- var _this = _super.call(this, elementRef, ganttUpper) || this;
2178
- _this.dragContainer = dragContainer;
2179
- _this.drag = drag;
2180
- _this.ganttUpper = ganttUpper;
2181
- _this.barClick = new core.EventEmitter();
2182
- _this.ganttItemClass = true;
2183
- _this.color = 'red';
2184
- return _this;
2185
- }
2186
- NgxGanttBarComponent.prototype.ngOnInit = function () {
2187
- var _this = this;
2188
- _super.prototype.onInit.call(this);
2189
- this.dragContainer.dragEnded.pipe(operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2190
- _this.setContentBackground();
2191
- });
2192
- };
2193
- NgxGanttBarComponent.prototype.ngAfterViewInit = function () {
2194
- this.drag.createDrags(this.elementRef, this.item, this.ganttUpper);
2195
- this.setContentBackground();
2196
- };
2197
- NgxGanttBarComponent.prototype.ngOnChanges = function () {
2198
- _super.prototype.onChanges.call(this);
2199
- };
2200
- NgxGanttBarComponent.prototype.onBarClick = function (event) {
2201
- this.barClick.emit({ event: event, item: this.item.origin });
2202
- };
2203
- NgxGanttBarComponent.prototype.setContentBackground = function () {
2204
- var contentElement = this.contentElementRef.nativeElement;
2205
- var color = this.item.color || barBackground;
2206
- var style = this.item.barStyle || {};
2207
- if (this.item.origin.start && this.item.origin.end) {
2208
- style.background = color;
2209
- style.borderRadius = '';
2210
- }
2211
- if (this.item.origin.start && !this.item.origin.end) {
2212
- style.background = linearGradient('to left', hexToRgb(color, 0.55), hexToRgb(color, 1));
2213
- style.borderRadius = '4px 12.5px 12.5px 4px';
2214
- }
2215
- if (!this.item.origin.start && this.item.origin.end) {
2216
- style.background = linearGradient('to right', hexToRgb(color, 0.55), hexToRgb(color, 1));
2217
- style.borderRadius = '12.5px 4px 4px 12.5px';
2218
- }
2219
- if (this.item.progress >= 0) {
2220
- var contentProgressElement = contentElement.querySelector('.gantt-bar-content-progress');
2221
- style.background = hexToRgb(color, 0.3);
2222
- style.borderRadius = '';
2223
- contentProgressElement.style.background = color;
2224
- }
2225
- for (var key in style) {
2226
- if (style.hasOwnProperty(key)) {
2227
- contentElement.style[key] = style[key];
2228
- }
2229
- }
2230
- };
2231
- NgxGanttBarComponent.prototype.stopPropagation = function (event) {
2232
- event.stopPropagation();
2233
- };
2234
- NgxGanttBarComponent.prototype.ngOnDestroy = function () {
2235
- _super.prototype.onDestroy.call(this);
2236
- };
2237
- return NgxGanttBarComponent;
2238
- }(GanttItemUpper));
2239
- NgxGanttBarComponent.decorators = [
2240
- { type: core.Component, args: [{
2241
- selector: 'ngx-gantt-bar,gantt-bar',
2242
- template: "<div class=\"gantt-bar-layer\">\n <div *ngIf=\"item.draggable && ganttUpper.draggable\" class=\"drag-handles\">\n <ng-container>\n <span class=\"handle\" (mousedown)=\"stopPropagation($event)\"></span>\n <span class=\"handle\" (mousedown)=\"stopPropagation($event)\"></span>\n </ng-container>\n </div>\n <div *ngIf=\"item.linkable && ganttUpper.linkable\" class=\"link-handles\">\n <span class=\"handle\"><span class=\"point\"></span></span>\n <span class=\"handle\"> <span class=\"point\"></span></span>\n </div>\n</div>\n<div class=\"gantt-bar-border\"></div>\n<div #content class=\"gantt-bar-content\" (click)=\"onBarClick($event)\">\n <div class=\"gantt-bar-content-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</div>\n",
2243
- providers: [GanttBarDrag]
2244
- },] }
2245
- ];
2246
- NgxGanttBarComponent.ctorParameters = function () { return [
2247
- { type: GanttDragContainer },
2248
- { type: GanttBarDrag },
2249
- { type: core.ElementRef },
2250
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] }
2251
- ]; };
2252
- NgxGanttBarComponent.propDecorators = {
2253
- barClick: [{ type: core.Output }],
2254
- contentElementRef: [{ type: core.ViewChild, args: ['content',] }],
2255
- ganttItemClass: [{ type: core.HostBinding, args: ['class.gantt-bar',] }]
2256
- };
2257
-
2258
- var GanttMainComponent = /** @class */ (function () {
2259
- function GanttMainComponent(ganttUpper) {
2260
- this.ganttUpper = ganttUpper;
2261
- this.barClick = new core.EventEmitter();
2262
- this.lineClick = new core.EventEmitter();
2263
- this.ganttMainClass = true;
2264
- }
2265
- GanttMainComponent.prototype.ngOnInit = function () { };
2266
- GanttMainComponent.prototype.trackBy = function (item, index) {
2267
- return item.id || index;
2268
- };
2269
- return GanttMainComponent;
2270
- }());
2271
- GanttMainComponent.decorators = [
2272
- { type: core.Component, args: [{
2273
- selector: 'gantt-main',
2274
- template: "<gantt-links-overlay [groups]=\"groups\" [items]=\"items\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<!-- groups -->\n<div class=\"gantt-main-groups\" *ngIf=\"groups && groups.length > 0; else itemsTemplate\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"group.class\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: group }\"></ng-template>\n </div>\n <div *ngIf=\"group.expanded\" class=\"gantt-items\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: group.items }\"></ng-template>\n </div>\n </ng-container>\n</div>\n<!-- items -->\n<ng-template #itemsTemplate>\n <div class=\"gantt-main-items\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items }\"></ng-template>\n </div>\n</ng-template>\n\n<ng-template #ganttItems let-items=\"items\">\n <ng-container *ngFor=\"let item of items; trackBy: trackBy\">\n <div class=\"gantt-item\" [style.height.px]=\"ganttUpper.styles.lineHeight\">\n <ng-container *ngIf=\"item.type | isGanttCustomItem\">\n <ng-template [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n </ng-container>\n <gantt-range *ngIf=\"item.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"item\"></gantt-range>\n <gantt-bar *ngIf=\"item.type | isGanttBarItem\" [item]=\"item\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n"
2275
- },] }
2276
- ];
2277
- GanttMainComponent.ctorParameters = function () { return [
2278
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] }
2279
- ]; };
2280
- GanttMainComponent.propDecorators = {
2281
- groups: [{ type: core.Input }],
2282
- items: [{ type: core.Input }],
2283
- groupHeaderTemplate: [{ type: core.Input }],
2284
- itemTemplate: [{ type: core.Input }],
2285
- barTemplate: [{ type: core.Input }],
2286
- rangeTemplate: [{ type: core.Input }],
2287
- barClick: [{ type: core.Output }],
2288
- lineClick: [{ type: core.Output }],
2289
- ganttMainClass: [{ type: core.HostBinding, args: ['class.gantt-main-container',] }]
2290
- };
2291
-
2292
- var 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>";
2293
- var 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>";
2294
- var 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>";
2295
- var 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>";
2296
- var 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\">\n<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)\">\n <animateTransform attributeType=\"xml\" attributeName=\"transform\" type=\"rotate\" from=\"0 25 25\" to=\"360 25 25\" dur=\"0.6s\" repeatCount=\"indefinite\"></animateTransform>\n</path>\n</svg>";
2297
- var emptyIcon = "<svg\nwidth=\"148px\"\nheight=\"134px\"\nviewBox=\"0 0 148 134\"\nversion=\"1.1\"\nxmlns=\"http://www.w3.org/2000/svg\"\nxmlns:xlink=\"http://www.w3.org/1999/xlink\"\n>\n<defs>\n <filter x=\"0.0%\" y=\"0.0%\" width=\"100.0%\" height=\"100.0%\" filterUnits=\"objectBoundingBox\" id=\"filter-1\">\n <feGaussianBlur stdDeviation=\"0\" in=\"SourceGraphic\"></feGaussianBlur>\n </filter>\n</defs>\n<g id=\"148x134\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g id=\"\u7F16\u7EC4-6\" transform=\"translate(1.000000, 1.000000)\">\n <ellipse\n id=\"\u692D\u5706\u5F62\"\n fill=\"#EDEEF2\"\n opacity=\"0.3\"\n filter=\"url(#filter-1)\"\n cx=\"73.0800017\"\n cy=\"115.920003\"\n rx=\"73.0800017\"\n ry=\"16.8000004\"\n ></ellipse>\n <g id=\"\u7F16\u7EC4-5\" transform=\"translate(15.120000, 0.000000)\">\n <polygon\n id=\"\u77E9\u5F62\"\n fill=\"#E2E4E9\"\n points=\"19.2789848 49.5600011 99.1200023 48.7200011 117.600003 75.9297673 117.600003 92.313049 0 92.313049 0 75.0356267\"\n ></polygon>\n <path\n 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\"\n id=\"\u77E9\u5F62\"\n fill=\"#F9FAFB\"\n ></path>\n <path\n 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\"\n id=\"\u77E9\u5F62\"\n fill=\"#E8EAEE\"\n ></path>\n <text\n id=\"&lt;/null&gt;\"\n font-family=\"PingFangSC-Medium, PingFang SC\"\n font-size=\"15.1200003\"\n font-weight=\"400\"\n fill=\"#BCBECD\"\n >\n <tspan x=\"33.6000008\" y=\"32.8000004\">&lt;/null&gt;</tspan>\n </text>\n <rect id=\"\u77E9\u5F62\" fill=\"#E8EAEE\" x=\"27.5600006\" y=\"52.0800012\" width=\"61.4800014\" height=\"5.04000011\" rx=\"2.52000006\"></rect>\n <rect\n id=\"\u77E9\u5F62\u5907\u4EFD\"\n fill=\"#E8EAEE\"\n x=\"27.5600006\"\n y=\"63.8400014\"\n width=\"61.4800014\"\n height=\"5.04000011\"\n rx=\"2.52000006\"\n ></rect>\n <path\n 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\"\n id=\"\u77E9\u5F62\"\n fill=\"#EDEFF2\"\n ></path>\n </g>\n </g>\n</g>\n</svg>";
2298
- var icons = {
2299
- 'angle-right': angleRight,
2300
- 'angle-down': angleDown,
2301
- 'plus-square': plusSquare,
2302
- 'minus-square': minusSquare,
2303
- loading: loadingIcon,
2304
- empty: emptyIcon
2305
- };
2306
-
2307
- var GanttIconComponent = /** @class */ (function () {
2308
- function GanttIconComponent(elementRef) {
2309
- this.elementRef = elementRef;
2310
- this.isIcon = true;
2311
- }
2312
- Object.defineProperty(GanttIconComponent.prototype, "iconName", {
2313
- set: function (name) {
2314
- this.setSvg(name);
2315
- },
2316
- enumerable: false,
2317
- configurable: true
2318
- });
2319
- GanttIconComponent.prototype.ngOnInit = function () { };
2320
- GanttIconComponent.prototype.ngAfterViewInit = function () { };
2321
- GanttIconComponent.prototype.setSvg = function (name) {
2322
- var iconSvg = icons[name];
2323
- if (iconSvg) {
2324
- this.elementRef.nativeElement.innerHTML = iconSvg;
2325
- }
2326
- else {
2327
- this.elementRef.nativeElement.innerHTML = '';
2328
- }
2329
- };
2330
- return GanttIconComponent;
2331
- }());
2332
- GanttIconComponent.decorators = [
2333
- { type: core.Component, args: [{
2334
- selector: 'gantt-icon',
2335
- template: ''
2336
- },] }
2337
- ];
2338
- GanttIconComponent.ctorParameters = function () { return [
2339
- { type: core.ElementRef }
2340
- ]; };
2341
- GanttIconComponent.propDecorators = {
2342
- isIcon: [{ type: core.HostBinding, args: ['class.gantt-icon',] }],
2343
- iconName: [{ type: core.Input }]
2344
- };
2345
-
2346
- var GanttDragBackdropComponent = /** @class */ (function () {
2347
- function GanttDragBackdropComponent() {
2348
- this.backdropClass = true;
2349
- }
2350
- GanttDragBackdropComponent.prototype.ngOnInit = function () { };
2351
- return GanttDragBackdropComponent;
2352
- }());
2353
- GanttDragBackdropComponent.decorators = [
2354
- { type: core.Component, args: [{
2355
- selector: 'gantt-drag-backdrop',
2356
- template: "<div class=\"gantt-drag-mask\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n"
2357
- },] }
2358
- ];
2359
- GanttDragBackdropComponent.ctorParameters = function () { return []; };
2360
- GanttDragBackdropComponent.propDecorators = {
2361
- backdropClass: [{ type: core.HostBinding, args: ['class.gantt-drag-backdrop',] }]
2362
- };
2363
-
2364
- var LinkColors;
2365
- (function (LinkColors) {
2366
- LinkColors["default"] = "#cacaca";
2367
- LinkColors["blocked"] = "#FF7575";
2368
- LinkColors["active"] = "#348FE4";
2369
- })(LinkColors || (LinkColors = {}));
2370
- var GanttLinksComponent = /** @class */ (function () {
2371
- function GanttLinksComponent(ganttUpper, cdr, elementRef, ganttDragContainer) {
2372
- this.ganttUpper = ganttUpper;
2373
- this.cdr = cdr;
2374
- this.elementRef = elementRef;
2375
- this.ganttDragContainer = ganttDragContainer;
2376
- this.groups = [];
2377
- this.items = [];
2378
- this.lineClick = new core.EventEmitter();
2379
- this.links = [];
2380
- this.linkItems = [];
2381
- this.bezierWeight = -0.5;
2382
- this.firstChange = true;
2383
- this.unsubscribe$ = new rxjs.Subject();
2384
- this.ganttLinksOverlay = true;
2385
- }
2386
- GanttLinksComponent.prototype.ngOnInit = function () {
2387
- var _this = this;
2388
- this.buildLinks();
2389
- this.firstChange = false;
2390
- this.ganttDragContainer.dragStarted.pipe(operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2391
- _this.elementRef.nativeElement.style.visibility = 'hidden';
2392
- });
2393
- rxjs.merge(this.ganttUpper.viewChange, this.ganttUpper.expandChange, this.ganttUpper.view.start$, this.ganttUpper.dragEnded, this.ganttUpper.linkDragEnded)
2394
- .pipe(operators.takeUntil(this.unsubscribe$), operators.skip(1))
2395
- .subscribe(function () {
2396
- _this.elementRef.nativeElement.style.visibility = 'visible';
2397
- _this.buildLinks();
2398
- _this.cdr.detectChanges();
2399
- });
2400
- };
2401
- GanttLinksComponent.prototype.ngOnChanges = function () {
2402
- if (!this.firstChange) {
2403
- this.buildLinks();
2404
- }
2405
- };
2406
- GanttLinksComponent.prototype.computeItemPosition = function () {
2407
- var _this = this;
2408
- var lineHeight = this.ganttUpper.styles.lineHeight;
2409
- var barHeight = this.ganttUpper.styles.barHeight;
2410
- this.linkItems = [];
2411
- if (this.groups.length > 0) {
2412
- var itemNum_1 = 0;
2413
- var groupNum_1 = 0;
2414
- this.groups.forEach(function (group) {
2415
- groupNum_1++;
2416
- if (group.expanded) {
2417
- var items = recursiveItems(group.items);
2418
- items.forEach(function (item, itemIndex) {
2419
- var y = (groupNum_1 + itemNum_1 + itemIndex) * lineHeight + item.refs.y + barHeight / 2;
2420
- _this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
2421
- x: item.refs.x,
2422
- y: y
2423
- }, after: {
2424
- x: item.refs.x + item.refs.width,
2425
- y: y
2426
- } }));
2427
- });
2428
- itemNum_1 += items.length;
2429
- }
2430
- });
2431
- }
2432
- else {
2433
- var items = recursiveItems(this.items);
2434
- items.forEach(function (item, itemIndex) {
2435
- var y = itemIndex * lineHeight + item.refs.y + barHeight / 2;
2436
- _this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
2437
- x: item.refs.x,
2438
- y: y
2439
- }, after: {
2440
- x: item.refs.x + item.refs.width,
2441
- y: y
2442
- } }));
2443
- });
2444
- }
2445
- };
2446
- GanttLinksComponent.prototype.generatePath = function (source, target) {
2447
- if (source.before && source.after && target.before && target.after) {
2448
- var x1 = source.after.x;
2449
- var y1 = source.after.y;
2450
- var x4 = target.before.x;
2451
- var y4 = target.before.y;
2452
- var dx = Math.abs(x4 - x1) * this.bezierWeight;
2453
- var x2 = x1 - dx;
2454
- var x3 = x4 + dx;
2455
- var centerX = (x1 + x4) / 2;
2456
- var centerY = (y1 + y4) / 2;
2457
- var controlX = this.ganttUpper.styles.lineHeight / 2;
2458
- var controlY = this.ganttUpper.styles.lineHeight / 2;
2459
- if (x1 >= x4) {
2460
- if (y4 > y1) {
2461
- if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
2462
- return "M " + x1 + " " + y1 + "\n C " + (x1 + controlX) + " " + y1 + " " + (x1 + controlX) + " " + (y1 + controlX) + " " + x1 + " " + (y1 + controlY) + "\n L " + x1 + " " + (y1 + controlY) + " " + centerX + " " + centerY + "\n\n M " + x4 + " " + y4 + "\n C " + (x4 - controlX) + " " + y4 + " " + (x4 - controlX) + " " + (y4 - controlX) + " " + x4 + " " + (y4 - controlY) + "\n L " + x4 + " " + (y4 - controlY) + " " + centerX + " " + centerY;
2463
- }
2464
- else {
2465
- controlX = this.ganttUpper.styles.lineHeight;
2466
- return "M " + x1 + " " + y1 + "\n C " + (x1 + controlX) + " " + y1 + " " + (x1 + controlX) + " " + (y1 + controlX) + " " + centerX + " " + centerY + "\n\n\n M " + x4 + " " + y4 + "\n C " + (x4 - controlX) + " " + y4 + " " + (x4 - controlX) + " " + (y4 - controlX) + " " + centerX + " " + centerY;
2467
- }
2468
- }
2469
- else {
2470
- if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
2471
- return "M " + x1 + " " + y1 + "\n C " + (x1 + controlX) + " " + y1 + " " + (x1 + controlX) + " " + (y1 - controlX) + " " + x1 + " " + (y1 - controlY) + "\n L " + x1 + " " + (y1 - controlY) + " " + centerX + " " + centerY + "\n\n M " + x4 + " " + y4 + "\n C " + (x4 - controlX) + " " + y4 + " " + (x4 - controlX) + " " + (y4 + controlX) + " " + x4 + " " + (y4 + controlY) + "\n L " + x4 + " " + (y4 + controlY) + " " + centerX + " " + centerY + "\n ";
2472
- }
2473
- else {
2474
- controlX = this.ganttUpper.styles.lineHeight;
2475
- return "M " + x1 + " " + y1 + "\n C " + (x1 + controlX) + " " + y1 + " " + (x1 + controlX) + " " + (y1 - controlX) + " " + centerX + " " + centerY + "\n\n M " + x4 + " " + y4 + "\n C " + (x4 - controlX) + " " + y4 + " " + (x4 - controlX) + " " + (y4 + controlX) + " " + centerX + " " + centerY;
2476
- }
2477
- }
2478
- }
2479
- return "M " + x1 + " " + y1 + " C " + x2 + " " + y1 + " " + x3 + " " + y4 + " " + x4 + " " + y4;
2480
- }
2481
- };
2482
- GanttLinksComponent.prototype.buildLinks = function () {
2483
- var _this = this;
2484
- this.computeItemPosition();
2485
- this.links = [];
2486
- this.linkItems.forEach(function (source) {
2487
- if (source.origin.start || source.origin.end) {
2488
- source.links.forEach(function (linkId) {
2489
- var target = _this.linkItems.find(function (item) { return item.id === linkId; });
2490
- if (target && (target.origin.start || target.origin.end)) {
2491
- _this.links.push({
2492
- path: _this.generatePath(source, target),
2493
- source: source.origin,
2494
- target: target.origin,
2495
- color: source.end.getTime() > target.start.getTime() ? LinkColors.blocked : LinkColors.default
2496
- });
2497
- }
2498
- });
2499
- }
2500
- });
2501
- };
2502
- GanttLinksComponent.prototype.trackBy = function (index) {
2503
- return index;
2504
- };
2505
- GanttLinksComponent.prototype.onLineClick = function (event, link) {
2506
- this.lineClick.emit({
2507
- event: event,
2508
- source: link.source,
2509
- target: link.target
2510
- });
2511
- };
2512
- GanttLinksComponent.prototype.mouseEnterPath = function (link) {
2513
- if (link.color === LinkColors.default) {
2514
- link.color = LinkColors.active;
2515
- }
2516
- };
2517
- GanttLinksComponent.prototype.mouseLeavePath = function (link) {
2518
- if (link.color === LinkColors.active) {
2519
- link.color = LinkColors.default;
2520
- }
2521
- };
2522
- GanttLinksComponent.prototype.ngOnDestroy = function () {
2523
- this.unsubscribe$.next();
2524
- this.unsubscribe$.complete();
2525
- };
2526
- return GanttLinksComponent;
2527
- }());
2528
- GanttLinksComponent.decorators = [
2529
- { type: core.Component, args: [{
2530
- selector: 'gantt-links-overlay',
2531
- template: "<svg [attr.width]=\"ganttUpper.view.width\" class=\"gantt-links-overlay-main\">\n <ng-container *ngFor=\"let link of links; let i = index; trackBy: trackBy\">\n <path [attr.d]=\"link.path\" fill=\"transparent\" stroke-width=\"2\" [attr.stroke]=\"link.color\" pointer-events=\"none\"></path>\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n (mouseenter)=\"mouseEnterPath(link)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n [attr.d]=\"link.path\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n </ng-container>\n <line class=\"link-dragging-line\"></line>\n</svg>\n"
2532
- },] }
2533
- ];
2534
- GanttLinksComponent.ctorParameters = function () { return [
2535
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] },
2536
- { type: core.ChangeDetectorRef },
2537
- { type: core.ElementRef },
2538
- { type: GanttDragContainer }
2539
- ]; };
2540
- GanttLinksComponent.propDecorators = {
2541
- groups: [{ type: core.Input }],
2542
- items: [{ type: core.Input }],
2543
- lineClick: [{ type: core.Output }],
2544
- ganttLinksOverlay: [{ type: core.HostBinding, args: ['class.gantt-links-overlay',] }]
2545
- };
2546
-
2547
- var GanttPrintService = /** @class */ (function () {
2548
- function GanttPrintService() {
2549
- }
2550
- GanttPrintService.prototype.setInlineStyles = function (targetElem) {
2551
- var e_1, _a;
2552
- var svgElements = Array.from(targetElem.getElementsByTagName('svg'));
2553
- try {
2554
- for (var svgElements_1 = __values(svgElements), svgElements_1_1 = svgElements_1.next(); !svgElements_1_1.done; svgElements_1_1 = svgElements_1.next()) {
2555
- var svgElement = svgElements_1_1.value;
2556
- this.recursElementChildren(svgElement);
2557
- }
2558
- }
2559
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2560
- finally {
2561
- try {
2562
- if (svgElements_1_1 && !svgElements_1_1.done && (_a = svgElements_1.return)) _a.call(svgElements_1);
2563
- }
2564
- finally { if (e_1) throw e_1.error; }
2565
- }
2566
- };
2567
- GanttPrintService.prototype.recursElementChildren = function (node) {
2568
- var e_2, _a, e_3, _b;
2569
- var transformProperties = [
2570
- 'fill',
2571
- 'color',
2572
- 'font-size',
2573
- 'stroke',
2574
- 'font',
2575
- 'text-anchor',
2576
- 'stroke-dasharray',
2577
- 'shape-rendering',
2578
- 'stroke-width'
2579
- ];
2580
- if (!node.style) {
2581
- return;
2582
- }
2583
- var styles = getComputedStyle(node);
2584
- try {
2585
- for (var transformProperties_1 = __values(transformProperties), transformProperties_1_1 = transformProperties_1.next(); !transformProperties_1_1.done; transformProperties_1_1 = transformProperties_1.next()) {
2586
- var transformProperty = transformProperties_1_1.value;
2587
- node.style[transformProperty] = styles[transformProperty];
2588
- }
2589
- }
2590
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2591
- finally {
2592
- try {
2593
- if (transformProperties_1_1 && !transformProperties_1_1.done && (_a = transformProperties_1.return)) _a.call(transformProperties_1);
2594
- }
2595
- finally { if (e_2) throw e_2.error; }
2596
- }
2597
- try {
2598
- for (var _c = __values(Array.from(node.childNodes)), _d = _c.next(); !_d.done; _d = _c.next()) {
2599
- var child = _d.value;
2600
- this.recursElementChildren(child);
2601
- }
2602
- }
2603
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
2604
- finally {
2605
- try {
2606
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2607
- }
2608
- finally { if (e_3) throw e_3.error; }
2609
- }
2610
- };
2611
- GanttPrintService.prototype.register = function (root) {
2612
- this.root = root.nativeElement;
2613
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
2614
- };
2615
- GanttPrintService.prototype.print = function (name, ignoreElementClass) {
2616
- var _this = this;
2617
- if (name === void 0) { name = 'download'; }
2618
- var root = this.root;
2619
- var mainContainer = this.mainContainer;
2620
- // set print width
2621
- var printWidth = root.offsetWidth;
2622
- // set print height
2623
- var printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
2624
- html2canvas__default['default'](root, {
2625
- logging: false,
2626
- allowTaint: true,
2627
- useCORS: true,
2628
- width: printWidth,
2629
- height: printHeight,
2630
- ignoreElements: function (element) {
2631
- if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
2632
- return true;
2633
- }
2634
- if (element.classList.contains('gantt-calendar-today-overlay')) {
2635
- return true;
2636
- }
2637
- },
2638
- onclone: function (cloneDocument) {
2639
- var ganttClass = root.className;
2640
- var cloneGanttDom = cloneDocument.querySelector("." + ganttClass.replace(/\s+/g, '.'));
2641
- var cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
2642
- var cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
2643
- var cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
2644
- // change targetDom width
2645
- cloneGanttDom.style.width = printWidth + "px";
2646
- cloneGanttDom.style.height = printHeight + "px";
2647
- cloneGanttDom.style.overflow = "unset";
2648
- cloneGanttContainerDom.style.backgroundColor = '#fff';
2649
- cloneCalendarOverlay.setAttribute('height', "" + printHeight);
2650
- cloneCalendarOverlay.setAttribute('style', "background: transparent");
2651
- if (cloneLinksOverlay) {
2652
- cloneLinksOverlay.setAttribute('height', "" + printHeight);
2653
- cloneLinksOverlay.setAttribute('style', "height: " + printHeight + "px");
2654
- }
2655
- // setInlineStyles for svg
2656
- _this.setInlineStyles(cloneGanttDom);
2657
- }
2658
- }).then(function (canvas) {
2659
- var link = document.createElement('a');
2660
- var dataUrl = canvas.toDataURL('image/png');
2661
- link.download = name + ".png";
2662
- link.href = dataUrl;
2663
- link.click();
2664
- });
2665
- };
2666
- return GanttPrintService;
2667
- }());
2668
- GanttPrintService.decorators = [
2669
- { type: core.Injectable }
2670
- ];
2671
- GanttPrintService.ctorParameters = function () { return []; };
2672
-
2673
- var NgxGanttRootComponent = /** @class */ (function () {
2674
- function NgxGanttRootComponent(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
2675
- this.elementRef = elementRef;
2676
- this.ngZone = ngZone;
2677
- this.dom = dom;
2678
- this.dragContainer = dragContainer;
2679
- this.ganttUpper = ganttUpper;
2680
- this.printService = printService;
2681
- this.ganttClass = true;
2682
- this.unsubscribe$ = new rxjs.Subject();
2683
- this.ganttUpper.dragContainer = dragContainer;
2684
- }
2685
- Object.defineProperty(NgxGanttRootComponent.prototype, "view", {
2686
- get: function () {
2687
- return this.ganttUpper.view;
2688
- },
2689
- enumerable: false,
2690
- configurable: true
2691
- });
2692
- NgxGanttRootComponent.prototype.ngOnInit = function () {
2693
- var _this = this;
2694
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
2695
- _this.dom.initialize(_this.elementRef);
2696
- if (_this.printService) {
2697
- _this.printService.register(_this.elementRef);
2698
- }
2699
- _this.setupScrollClass();
2700
- _this.setupResize();
2701
- _this.setupViewScroll();
2702
- // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2703
- _this.elementRef.nativeElement.style.opacity = '1';
2704
- _this.ganttUpper.viewChange.pipe(operators.startWith(null)).subscribe(function () {
2705
- _this.scrollToToday();
2706
- });
2707
- });
2708
- };
2709
- NgxGanttRootComponent.prototype.setupViewScroll = function () {
2710
- var _this = this;
2711
- if (this.ganttUpper.disabledLoadOnScroll) {
2712
- return;
2713
- }
2714
- this.dom
2715
- .getViewerScroll()
2716
- .pipe(operators.takeUntil(this.unsubscribe$))
2717
- .subscribe(function (event) {
2718
- if (event.direction === ScrollDirection.LEFT) {
2719
- var dates_1 = _this.view.addStartDate();
2720
- if (dates_1) {
2721
- event.target.scrollLeft += _this.view.getDateRangeWidth(dates_1.start, dates_1.end);
2722
- _this.ngZone.run(function () {
2723
- _this.ganttUpper.loadOnScroll.emit({ start: dates_1.start.getUnixTime(), end: dates_1.end.getUnixTime() });
2724
- });
2725
- }
2726
- }
2727
- if (event.direction === ScrollDirection.RIGHT) {
2728
- var dates_2 = _this.view.addEndDate();
2729
- if (dates_2) {
2730
- _this.ngZone.run(function () {
2731
- _this.ganttUpper.loadOnScroll.emit({ start: dates_2.start.getUnixTime(), end: dates_2.end.getUnixTime() });
2732
- });
2733
- }
2734
- }
2735
- });
2736
- };
2737
- NgxGanttRootComponent.prototype.setupResize = function () {
2738
- var _this = this;
2739
- this.dom
2740
- .getResize()
2741
- .pipe(operators.takeUntil(this.unsubscribe$))
2742
- .subscribe(function () {
2743
- _this.setupScrollClass();
2744
- });
2745
- };
2746
- NgxGanttRootComponent.prototype.setupScrollClass = function () {
2747
- var mainContainer = this.dom.mainContainer;
2748
- var height = mainContainer.offsetHeight;
2749
- var scrollHeight = mainContainer.scrollHeight;
2750
- if (scrollHeight > height) {
2751
- this.elementRef.nativeElement.className = 'gantt gantt-scroll';
2752
- }
2753
- else {
2754
- this.elementRef.nativeElement.className = 'gantt';
2755
- }
2756
- };
2757
- NgxGanttRootComponent.prototype.scrollToToday = function () {
2758
- var x = this.view.getTodayXPoint();
2759
- this.dom.scrollMainContainer(x);
2760
- };
2761
- return NgxGanttRootComponent;
2762
- }());
2763
- NgxGanttRootComponent.decorators = [
2764
- { type: core.Component, args: [{
2765
- selector: 'ngx-gantt-root',
2766
- template: "<div class=\"gantt-side\" [style.width.px]=\"sideWidth\">\n <div class=\"gantt-side-container\">\n <ng-template [ngTemplateOutlet]=\"sideTemplate\"></ng-template>\n </div>\n</div>\n<div class=\"gantt-container\">\n <gantt-calendar-overlay></gantt-calendar-overlay>\n <gantt-drag-backdrop></gantt-drag-backdrop>\n <div class=\"gantt-main\">\n <ng-template [ngTemplateOutlet]=\"mainTemplate\"></ng-template>\n </div>\n</div>\n",
2767
- providers: [GanttDomService, GanttDragContainer]
2768
- },] }
2769
- ];
2770
- NgxGanttRootComponent.ctorParameters = function () { return [
2771
- { type: core.ElementRef },
2772
- { type: core.NgZone },
2773
- { type: GanttDomService },
2774
- { type: GanttDragContainer },
2775
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] },
2776
- { type: GanttPrintService, decorators: [{ type: core.Optional }] }
2777
- ]; };
2778
- NgxGanttRootComponent.propDecorators = {
2779
- sideWidth: [{ type: core.Input }],
2780
- ganttClass: [{ type: core.HostBinding, args: ['class.gantt',] }],
2781
- sideTemplate: [{ type: core.ContentChild, args: ['sideTemplate', { static: true },] }],
2782
- mainTemplate: [{ type: core.ContentChild, args: ['mainTemplate', { static: true },] }]
2783
- };
2784
-
2785
- var NgxGanttRangeComponent = /** @class */ (function (_super) {
2786
- __extends(NgxGanttRangeComponent, _super);
2787
- function NgxGanttRangeComponent(elementRef, ganttUpper) {
2788
- var _this = _super.call(this, elementRef, ganttUpper) || this;
2789
- _this.ganttRangeClass = true;
2790
- return _this;
2791
- }
2792
- NgxGanttRangeComponent.prototype.ngOnInit = function () {
2793
- _super.prototype.onInit.call(this);
2794
- };
2795
- NgxGanttRangeComponent.prototype.ngOnChanges = function () {
2796
- _super.prototype.onChanges.call(this);
2797
- };
2798
- NgxGanttRangeComponent.prototype.ngOnDestroy = function () {
2799
- _super.prototype.onDestroy.call(this);
2800
- };
2801
- return NgxGanttRangeComponent;
2802
- }(GanttItemUpper));
2803
- NgxGanttRangeComponent.decorators = [
2804
- { type: core.Component, args: [{
2805
- selector: 'ngx-gantt-range,gantt-range',
2806
- template: "<ng-container *ngIf=\"item.start && item.end\">\n <div class=\"gantt-range-main\">\n <div class=\"gantt-range-main-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n </div>\n <div class=\"gantt-range-triangle left\"></div>\n <div class=\"gantt-range-triangle right\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</ng-container>\n"
2807
- },] }
2808
- ];
2809
- NgxGanttRangeComponent.ctorParameters = function () { return [
2810
- { type: core.ElementRef },
2811
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] }
2812
- ]; };
2813
- NgxGanttRangeComponent.propDecorators = {
2814
- ganttRangeClass: [{ type: core.HostBinding, args: ['class.gantt-range',] }]
2815
- };
2816
-
2817
- var IsGanttRangeItemPipe = /** @class */ (function () {
2818
- function IsGanttRangeItemPipe() {
2819
- }
2820
- IsGanttRangeItemPipe.prototype.transform = function (value) {
2821
- return value === exports.GanttItemType.range;
2822
- };
2823
- return IsGanttRangeItemPipe;
2824
- }());
2825
- IsGanttRangeItemPipe.decorators = [
2826
- { type: core.Pipe, args: [{
2827
- name: 'isGanttRangeItem'
2828
- },] }
2829
- ];
2830
- var IsGanttBarItemPipe = /** @class */ (function () {
2831
- function IsGanttBarItemPipe() {
2832
- }
2833
- IsGanttBarItemPipe.prototype.transform = function (value) {
2834
- return value === exports.GanttItemType.bar;
2835
- };
2836
- return IsGanttBarItemPipe;
2837
- }());
2838
- IsGanttBarItemPipe.decorators = [
2839
- { type: core.Pipe, args: [{
2840
- name: 'isGanttBarItem'
2841
- },] }
2842
- ];
2843
- var IsGanttCustomItemPipe = /** @class */ (function () {
2844
- function IsGanttCustomItemPipe() {
2845
- }
2846
- IsGanttCustomItemPipe.prototype.transform = function (value) {
2847
- return value === exports.GanttItemType.custom;
2848
- };
2849
- return IsGanttCustomItemPipe;
2850
- }());
2851
- IsGanttCustomItemPipe.decorators = [
2852
- { type: core.Pipe, args: [{
2853
- name: 'isGanttCustomItem'
2854
- },] }
2855
- ];
2856
-
2857
- var NgxGanttModule = /** @class */ (function () {
2858
- function NgxGanttModule() {
2859
- }
2860
- return NgxGanttModule;
2861
- }());
2862
- NgxGanttModule.decorators = [
2863
- { type: core.NgModule, args: [{
2864
- imports: [common.CommonModule, dragDrop.DragDropModule],
2865
- exports: [NgxGanttComponent, NgxGanttTableComponent, NgxGanttTableColumnComponent, NgxGanttRootComponent, NgxGanttBarComponent],
2866
- declarations: [
2867
- NgxGanttComponent,
2868
- NgxGanttTableComponent,
2869
- NgxGanttTableColumnComponent,
2870
- GanttTableComponent,
2871
- GanttMainComponent,
2872
- GanttCalendarComponent,
2873
- GanttLinksComponent,
2874
- NgxGanttBarComponent,
2875
- GanttIconComponent,
2876
- GanttDragBackdropComponent,
2877
- NgxGanttRangeComponent,
2878
- NgxGanttRootComponent,
2879
- IsGanttRangeItemPipe,
2880
- IsGanttBarItemPipe,
2881
- IsGanttCustomItemPipe
2882
- ],
2883
- providers: []
2884
- },] }
2885
- ];
2886
-
2887
- /*
2888
- * Public API Surface of gantt
2889
- */
2890
-
2891
- /**
2892
- * Generated bundle index. Do not edit.
2893
- */
2894
-
2895
- Object.defineProperty(exports, 'addDays', {
2896
- enumerable: true,
2897
- get: function () {
2898
- return dateFns.addDays;
2899
- }
2900
- });
2901
- Object.defineProperty(exports, 'addHours', {
2902
- enumerable: true,
2903
- get: function () {
2904
- return dateFns.addHours;
2905
- }
2906
- });
2907
- Object.defineProperty(exports, 'addMinutes', {
2908
- enumerable: true,
2909
- get: function () {
2910
- return dateFns.addMinutes;
2911
- }
2912
- });
2913
- Object.defineProperty(exports, 'addMonths', {
2914
- enumerable: true,
2915
- get: function () {
2916
- return dateFns.addMonths;
2917
- }
2918
- });
2919
- Object.defineProperty(exports, 'addQuarters', {
2920
- enumerable: true,
2921
- get: function () {
2922
- return dateFns.addQuarters;
2923
- }
2924
- });
2925
- Object.defineProperty(exports, 'addSeconds', {
2926
- enumerable: true,
2927
- get: function () {
2928
- return dateFns.addSeconds;
2929
- }
2930
- });
2931
- Object.defineProperty(exports, 'addWeeks', {
2932
- enumerable: true,
2933
- get: function () {
2934
- return dateFns.addWeeks;
2935
- }
2936
- });
2937
- Object.defineProperty(exports, 'addYears', {
2938
- enumerable: true,
2939
- get: function () {
2940
- return dateFns.addYears;
2941
- }
2942
- });
2943
- Object.defineProperty(exports, 'differenceInCalendarDays', {
2944
- enumerable: true,
2945
- get: function () {
2946
- return dateFns.differenceInCalendarDays;
2947
- }
2948
- });
2949
- Object.defineProperty(exports, 'differenceInCalendarQuarters', {
2950
- enumerable: true,
2951
- get: function () {
2952
- return dateFns.differenceInCalendarQuarters;
2953
- }
2954
- });
2955
- Object.defineProperty(exports, 'differenceInDays', {
2956
- enumerable: true,
2957
- get: function () {
2958
- return dateFns.differenceInDays;
2959
- }
2960
- });
2961
- Object.defineProperty(exports, 'eachDayOfInterval', {
2962
- enumerable: true,
2963
- get: function () {
2964
- return dateFns.eachDayOfInterval;
2965
- }
2966
- });
2967
- Object.defineProperty(exports, 'eachMonthOfInterval', {
2968
- enumerable: true,
2969
- get: function () {
2970
- return dateFns.eachMonthOfInterval;
2971
- }
2972
- });
2973
- Object.defineProperty(exports, 'eachWeekOfInterval', {
2974
- enumerable: true,
2975
- get: function () {
2976
- return dateFns.eachWeekOfInterval;
2977
- }
2978
- });
2979
- Object.defineProperty(exports, 'endOfDay', {
2980
- enumerable: true,
2981
- get: function () {
2982
- return dateFns.endOfDay;
2983
- }
2984
- });
2985
- Object.defineProperty(exports, 'endOfMonth', {
2986
- enumerable: true,
2987
- get: function () {
2988
- return dateFns.endOfMonth;
2989
- }
2990
- });
2991
- Object.defineProperty(exports, 'endOfQuarter', {
2992
- enumerable: true,
2993
- get: function () {
2994
- return dateFns.endOfQuarter;
2995
- }
2996
- });
2997
- Object.defineProperty(exports, 'endOfWeek', {
2998
- enumerable: true,
2999
- get: function () {
3000
- return dateFns.endOfWeek;
3001
- }
3002
- });
3003
- Object.defineProperty(exports, 'endOfYear', {
3004
- enumerable: true,
3005
- get: function () {
3006
- return dateFns.endOfYear;
3007
- }
3008
- });
3009
- Object.defineProperty(exports, 'format', {
3010
- enumerable: true,
3011
- get: function () {
3012
- return dateFns.format;
3013
- }
3014
- });
3015
- Object.defineProperty(exports, 'fromUnixTime', {
3016
- enumerable: true,
3017
- get: function () {
3018
- return dateFns.fromUnixTime;
3019
- }
3020
- });
3021
- Object.defineProperty(exports, 'getDaysInMonth', {
3022
- enumerable: true,
3023
- get: function () {
3024
- return dateFns.getDaysInMonth;
3025
- }
3026
- });
3027
- Object.defineProperty(exports, 'getUnixTime', {
3028
- enumerable: true,
3029
- get: function () {
3030
- return dateFns.getUnixTime;
3031
- }
3032
- });
3033
- Object.defineProperty(exports, 'getWeek', {
3034
- enumerable: true,
3035
- get: function () {
3036
- return dateFns.getWeek;
3037
- }
3038
- });
3039
- Object.defineProperty(exports, 'isToday', {
3040
- enumerable: true,
3041
- get: function () {
3042
- return dateFns.isToday;
3043
- }
3044
- });
3045
- Object.defineProperty(exports, 'isWeekend', {
3046
- enumerable: true,
3047
- get: function () {
3048
- return dateFns.isWeekend;
3049
- }
3050
- });
3051
- Object.defineProperty(exports, 'setDate', {
3052
- enumerable: true,
3053
- get: function () {
3054
- return dateFns.setDate;
3055
- }
3056
- });
3057
- Object.defineProperty(exports, 'startOfDay', {
3058
- enumerable: true,
3059
- get: function () {
3060
- return dateFns.startOfDay;
3061
- }
3062
- });
3063
- Object.defineProperty(exports, 'startOfMonth', {
3064
- enumerable: true,
3065
- get: function () {
3066
- return dateFns.startOfMonth;
3067
- }
3068
- });
3069
- Object.defineProperty(exports, 'startOfQuarter', {
3070
- enumerable: true,
3071
- get: function () {
3072
- return dateFns.startOfQuarter;
3073
- }
3074
- });
3075
- Object.defineProperty(exports, 'startOfWeek', {
3076
- enumerable: true,
3077
- get: function () {
3078
- return dateFns.startOfWeek;
3079
- }
3080
- });
3081
- Object.defineProperty(exports, 'startOfYear', {
3082
- enumerable: true,
3083
- get: function () {
3084
- return dateFns.startOfYear;
3085
- }
3086
- });
3087
- exports.GANTT_UPPER_TOKEN = GANTT_UPPER_TOKEN;
3088
- exports.GanttBarClickEvent = GanttBarClickEvent;
3089
- exports.GanttDate = GanttDate;
3090
- exports.GanttDatePoint = GanttDatePoint;
3091
- exports.GanttDragEvent = GanttDragEvent;
3092
- exports.GanttGroupInternal = GanttGroupInternal;
3093
- exports.GanttItemInternal = GanttItemInternal;
3094
- exports.GanttItemUpper = GanttItemUpper;
3095
- exports.GanttLineClickEvent = GanttLineClickEvent;
3096
- exports.GanttLinkDragEvent = GanttLinkDragEvent;
3097
- exports.GanttLoadOnScrollEvent = GanttLoadOnScrollEvent;
3098
- exports.GanttPrintService = GanttPrintService;
3099
- exports.GanttTableEvent = GanttTableEvent;
3100
- exports.GanttUpper = GanttUpper;
3101
- exports.GanttView = GanttView;
3102
- exports.IsGanttBarItemPipe = IsGanttBarItemPipe;
3103
- exports.IsGanttCustomItemPipe = IsGanttCustomItemPipe;
3104
- exports.IsGanttRangeItemPipe = IsGanttRangeItemPipe;
3105
- exports.NgxGanttComponent = NgxGanttComponent;
3106
- exports.NgxGanttModule = NgxGanttModule;
3107
- exports.NgxGanttRootComponent = NgxGanttRootComponent;
3108
- exports.NgxGanttTableColumnComponent = NgxGanttTableColumnComponent;
3109
- exports.NgxGanttTableComponent = NgxGanttTableComponent;
3110
- exports.defaultColumnWidth = defaultColumnWidth;
3111
- exports.minColumnWidth = minColumnWidth;
3112
- exports.primaryDatePointTop = primaryDatePointTop;
3113
- exports.secondaryDatePointTop = secondaryDatePointTop;
3114
- exports.ɵa = GanttDomService;
3115
- exports.ɵb = GanttDragContainer;
3116
- exports.ɵc = NgxGanttBarComponent;
3117
- exports.ɵd = GanttBarDrag;
3118
- exports.ɵe = GanttTableComponent;
3119
- exports.ɵf = GanttMainComponent;
3120
- exports.ɵg = GanttCalendarComponent;
3121
- exports.ɵh = GanttLinksComponent;
3122
- exports.ɵi = GanttIconComponent;
3123
- exports.ɵj = GanttDragBackdropComponent;
3124
- exports.ɵk = NgxGanttRangeComponent;
3125
-
3126
- Object.defineProperty(exports, '__esModule', { value: true });
3127
-
3128
- })));
3129
- //# sourceMappingURL=worktile-gantt.umd.js.map