@worktile/gantt 12.0.1 → 12.0.2

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