@worktile/gantt 12.1.0-next.0 → 12.2.0-next.0

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 (54) hide show
  1. package/bundles/worktile-gantt.umd.js +819 -936
  2. package/bundles/worktile-gantt.umd.js.map +1 -1
  3. package/class/item.d.ts +7 -7
  4. package/class/link.d.ts +39 -0
  5. package/components/calendar/{grid/calendar-grid.component.d.ts → calendar.component.d.ts} +10 -8
  6. package/components/links/links.component.d.ts +5 -15
  7. package/components/main/gantt-main.component.d.ts +4 -4
  8. package/components/table/gantt-table.component.d.ts +39 -0
  9. package/esm2015/class/item.js +14 -3
  10. package/esm2015/class/link.js +14 -0
  11. package/esm2015/components/bar/bar-drag.js +6 -1
  12. package/esm2015/components/calendar/calendar.component.js +86 -0
  13. package/esm2015/components/links/links.component.js +93 -33
  14. package/esm2015/components/main/gantt-main.component.js +5 -5
  15. package/esm2015/components/table/gantt-table.component.js +153 -0
  16. package/esm2015/gantt-dom.service.js +2 -5
  17. package/esm2015/gantt-drag-container.js +2 -1
  18. package/esm2015/gantt-item-upper.js +4 -5
  19. package/esm2015/gantt-print.service.js +2 -2
  20. package/esm2015/gantt-upper.js +67 -35
  21. package/esm2015/gantt.component.js +17 -172
  22. package/esm2015/gantt.config.js +13 -0
  23. package/esm2015/gantt.module.js +22 -18
  24. package/esm2015/public-api.js +2 -1
  25. package/esm2015/root.component.js +7 -8
  26. package/esm2015/table/gantt-table.component.js +9 -3
  27. package/esm2015/utils/helpers.js +10 -9
  28. package/esm2015/views/day.js +2 -2
  29. package/esm2015/views/month.js +3 -3
  30. package/esm2015/views/quarter.js +3 -3
  31. package/esm2015/views/view.js +4 -2
  32. package/esm2015/views/week.js +3 -3
  33. package/esm2015/views/year.js +2 -2
  34. package/fesm2015/worktile-gantt.js +806 -898
  35. package/fesm2015/worktile-gantt.js.map +1 -1
  36. package/gantt-dom.service.d.ts +0 -1
  37. package/gantt-drag-container.d.ts +1 -0
  38. package/gantt-upper.d.ts +12 -5
  39. package/gantt.component.d.ts +5 -26
  40. package/gantt.config.d.ts +23 -0
  41. package/gantt.module.d.ts +13 -16
  42. package/main.bundle.scss +195 -234
  43. package/package.json +1 -1
  44. package/public-api.d.ts +1 -0
  45. package/table/gantt-table.component.d.ts +4 -2
  46. package/utils/helpers.d.ts +3 -5
  47. package/views/view.d.ts +2 -0
  48. package/components/calendar/header/calendar-header.component.d.ts +0 -21
  49. package/components/table/body/gantt-table-body.component.d.ts +0 -24
  50. package/components/table/header/gantt-table-header.component.d.ts +0 -29
  51. package/esm2015/components/calendar/grid/calendar-grid.component.js +0 -76
  52. package/esm2015/components/calendar/header/calendar-header.component.js +0 -70
  53. package/esm2015/components/table/body/gantt-table-body.component.js +0 -68
  54. package/esm2015/components/table/header/gantt-table-header.component.js +0 -126
@@ -1,8 +1,8 @@
1
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/scrolling'), 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/scrolling', '@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.scrolling, global.ng.cdk.dragDrop, global.html2canvas));
5
- }(this, (function (exports, i0, i1, operators, rxjs, dateFns, coercion, i6, i1$1, html2canvas) { 'use strict';
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
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -27,9 +27,8 @@
27
27
  }
28
28
 
29
29
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
30
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
30
31
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
31
- var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
32
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
33
32
  var html2canvas__default = /*#__PURE__*/_interopDefaultLegacy(html2canvas);
34
33
 
35
34
  /*! *****************************************************************************
@@ -560,6 +559,20 @@
560
559
  GanttViewType["week"] = "week";
561
560
  })(exports.GanttViewType || (exports.GanttViewType = {}));
562
561
 
562
+ var GanttLinkType;
563
+ (function (GanttLinkType) {
564
+ GanttLinkType[GanttLinkType["fs"] = 0] = "fs";
565
+ GanttLinkType[GanttLinkType["ss"] = 1] = "ss";
566
+ GanttLinkType[GanttLinkType["ff"] = 2] = "ff";
567
+ GanttLinkType[GanttLinkType["sf"] = 3] = "sf";
568
+ })(GanttLinkType || (GanttLinkType = {}));
569
+ var LinkColors;
570
+ (function (LinkColors) {
571
+ LinkColors["default"] = "#cacaca";
572
+ LinkColors["blocked"] = "#FF7575";
573
+ LinkColors["active"] = "#348FE4";
574
+ })(LinkColors || (LinkColors = {}));
575
+
563
576
  exports.GanttItemType = void 0;
564
577
  (function (GanttItemType) {
565
578
  GanttItemType["bar"] = "bar";
@@ -572,7 +585,17 @@
572
585
  this.refs$ = new rxjs.BehaviorSubject(null);
573
586
  this.origin = item;
574
587
  this.id = this.origin.id;
575
- this.links = this.origin.links || [];
588
+ this.links = (this.origin.links || []).map(function (link) {
589
+ if (typeof link === 'string') {
590
+ return {
591
+ type: GanttLinkType.fs,
592
+ link: link
593
+ };
594
+ }
595
+ else {
596
+ return link;
597
+ }
598
+ });
576
599
  this.color = this.origin.color;
577
600
  this.barStyle = this.origin.barStyle;
578
601
  this.linkable = this.origin.linkable === undefined ? true : this.origin.linkable;
@@ -636,7 +659,7 @@
636
659
  this.origin.expanded = expanded;
637
660
  };
638
661
  GanttItemInternal.prototype.addLink = function (linkId) {
639
- this.links = __spreadArray(__spreadArray([], __read(this.links)), [linkId]);
662
+ this.links = __spreadArray(__spreadArray([], __read(this.links)), [{ type: GanttLinkType.fs, link: linkId }]);
640
663
  this.origin.links = this.links;
641
664
  };
642
665
  return GanttItemInternal;
@@ -660,11 +683,24 @@
660
683
  return GanttGroupInternal;
661
684
  }());
662
685
 
686
+ var defaultConfig = {
687
+ dateFormat: {
688
+ week: '第w周',
689
+ month: 'M月',
690
+ quarter: 'QQQ',
691
+ year: 'yyyy年',
692
+ yearMonth: 'yyyy年MM月',
693
+ yearQuarter: 'yyyy年QQQ',
694
+ }
695
+ };
696
+ var GANTT_GLOBAL_CONFIG = new i0.InjectionToken('GANTT_GLOBAL_CONFIG');
697
+
663
698
  var primaryDatePointTop = 18;
664
699
  var secondaryDatePointTop = 36;
665
700
  var viewOptions$5 = {
666
701
  min: new GanttDate().addYears(-1).startOfYear(),
667
- max: new GanttDate().addYears(1).endOfYear()
702
+ max: new GanttDate().addYears(1).endOfYear(),
703
+ dateFormat: defaultConfig.dateFormat
668
704
  };
669
705
  var GanttView = /** @class */ (function () {
670
706
  function GanttView(start, end, options) {
@@ -817,7 +853,7 @@
817
853
  var points = [];
818
854
  for (var i = 0; i < quarters; i++) {
819
855
  var start = this.start.addQuarters(i);
820
- var point = new GanttDatePoint(start, start.format('yyyy年QQQ'), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
856
+ var point = new GanttDatePoint(start, start.format(this.options.dateFormat.yearQuarter), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
821
857
  points.push(point);
822
858
  }
823
859
  return points;
@@ -827,7 +863,7 @@
827
863
  var points = [];
828
864
  for (var i = 0; i < months.length; i++) {
829
865
  var start = new GanttDate(months[i]);
830
- var point = new GanttDatePoint(start, start.getMonth() + 1 + "\u6708", i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
866
+ var point = new GanttDatePoint(start, start.format(this.options.dateFormat.month), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
831
867
  points.push(point);
832
868
  }
833
869
  return points;
@@ -866,7 +902,7 @@
866
902
  var points = [];
867
903
  for (var i = 0; i < years.length; i++) {
868
904
  var start = new GanttDate(years[i]);
869
- var point = new GanttDatePoint(start, start.format('yyyy') + "\u5E74", (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
905
+ var point = new GanttDatePoint(start, "" + start.format(this.options.dateFormat.year), (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
870
906
  points.push(point);
871
907
  }
872
908
  return points;
@@ -876,7 +912,7 @@
876
912
  var points = [];
877
913
  for (var i = 0; i <= quarters; i++) {
878
914
  var start = this.start.addQuarters(i);
879
- var point = new GanttDatePoint(start, start.format('QQQ'), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
915
+ var point = new GanttDatePoint(start, start.format(this.options.dateFormat.quarter), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
880
916
  points.push(point);
881
917
  }
882
918
  return points;
@@ -917,7 +953,7 @@
917
953
  for (var i = 0; i < weeks.length; i++) {
918
954
  var weekStart = new GanttDate(weeks[i]);
919
955
  var increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
920
- var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format('yyyy年MM月'), (this.getCellWidth() * 7) / 2 + i * (this.getCellWidth() * 7), primaryDatePointTop);
956
+ var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.yearMonth), (this.getCellWidth() * 7) / 2 + i * (this.getCellWidth() * 7), primaryDatePointTop);
921
957
  points.push(point);
922
958
  }
923
959
  return points;
@@ -968,7 +1004,7 @@
968
1004
  for (var i = 0; i < weeks.length; i++) {
969
1005
  var weekStart = new GanttDate(weeks[i]);
970
1006
  var increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
971
- var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format('yyyy年'), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
1007
+ var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.year), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
972
1008
  points.push(point);
973
1009
  }
974
1010
  return points;
@@ -978,7 +1014,7 @@
978
1014
  var points = [];
979
1015
  for (var i = 0; i < weeks.length; i++) {
980
1016
  var start = new GanttDate(weeks[i]);
981
- var point = new GanttDatePoint(start, "\u7B2C" + start.format('w') + "\u5468", i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
1017
+ var point = new GanttDatePoint(start, "" + start.format(this.options.dateFormat.week), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
982
1018
  points.push(point);
983
1019
  }
984
1020
  return points;
@@ -1026,7 +1062,7 @@
1026
1062
  var pointTop = 27;
1027
1063
  for (var i = 0; i <= years; i++) {
1028
1064
  var start = this.start.addYears(i);
1029
- var point = new GanttDatePoint(start, start.format('yyyy') + "\u5E74", i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
1065
+ var point = new GanttDatePoint(start, "" + start.format(this.options.dateFormat.year), i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
1030
1066
  points.push(point);
1031
1067
  }
1032
1068
  return points;
@@ -1101,40 +1137,43 @@
1101
1137
  return pre.concat(Array.isArray(cur) ? flatten(cur) : cur);
1102
1138
  }, []);
1103
1139
  }
1104
- function recursiveItems(items, level) {
1140
+ function recursiveItems(items) {
1105
1141
  var result = [];
1106
1142
  (items || []).forEach(function (item) {
1107
- item.level = level;
1108
1143
  result.push(item);
1109
1144
  if (item.expanded && item.children) {
1110
- result.push.apply(result, __spreadArray([], __read(recursiveItems(item.children, level + 1))));
1145
+ result.push.apply(result, __spreadArray([], __read(recursiveItems(item.children))));
1111
1146
  }
1112
1147
  });
1113
1148
  return result;
1114
1149
  }
1115
- function keyBy(array, key) {
1116
- var result = {};
1117
- array.forEach(function (item) {
1118
- var keyValue = item[key];
1119
- result[keyValue] = item;
1150
+ function getFlatItems(items) {
1151
+ var result = [];
1152
+ (items || []).forEach(function (item) {
1153
+ result.push(item);
1154
+ if (item.children) {
1155
+ result.push.apply(result, __spreadArray([], __read(getFlatItems(item.children))));
1156
+ }
1120
1157
  });
1121
1158
  return result;
1122
1159
  }
1123
1160
 
1124
1161
  var GanttUpper = /** @class */ (function () {
1125
- function GanttUpper(elementRef, cdr, ngZone) {
1162
+ function GanttUpper(elementRef, cdr, ngZone, config) {
1126
1163
  this.elementRef = elementRef;
1127
1164
  this.cdr = cdr;
1128
1165
  this.ngZone = ngZone;
1166
+ this.config = config;
1129
1167
  this.originItems = [];
1130
1168
  this.originGroups = [];
1131
1169
  this.viewType = exports.GanttViewType.month;
1132
1170
  this.showTodayLine = true;
1171
+ this.viewOptions = {};
1133
1172
  this.loadOnScroll = new i0.EventEmitter();
1134
1173
  this.dragStarted = new i0.EventEmitter();
1174
+ this.dragMoved = new i0.EventEmitter();
1135
1175
  this.dragEnded = new i0.EventEmitter();
1136
1176
  this.barClick = new i0.EventEmitter();
1137
- this.computeAllRefs = true;
1138
1177
  this.linkDragEnded = new i0.EventEmitter();
1139
1178
  this.items = [];
1140
1179
  this.groups = [];
@@ -1142,7 +1181,6 @@
1142
1181
  this.expandChange = new i0.EventEmitter();
1143
1182
  this.firstChange = true;
1144
1183
  this.unsubscribe$ = new rxjs.Subject();
1145
- this.expandedItemIds = [];
1146
1184
  this.ganttClass = true;
1147
1185
  }
1148
1186
  Object.defineProperty(GanttUpper.prototype, "element", {
@@ -1171,21 +1209,6 @@
1171
1209
  GanttUpper.prototype.setupItems = function () {
1172
1210
  var _this = this;
1173
1211
  this.originItems = uniqBy(this.originItems, 'id');
1174
- // 根据上一次数据展开状态同步新的数据展开状态
1175
- this.originItems.forEach(function (originItem) {
1176
- var _a, _b;
1177
- var oldItem = _this.items.find(function (item) {
1178
- return item.id === originItem.id;
1179
- });
1180
- if (!_this.firstChange) {
1181
- if (oldItem && !((_a = oldItem.children) === null || _a === void 0 ? void 0 : _a.length) && ((_b = originItem.children) === null || _b === void 0 ? void 0 : _b.length)) {
1182
- originItem.expanded = originItem.expanded || _this.expandedItemIds.includes(originItem.id);
1183
- }
1184
- else {
1185
- originItem.expanded = _this.expandedItemIds.includes(originItem.id);
1186
- }
1187
- }
1188
- });
1189
1212
  this.items = [];
1190
1213
  if (this.groups.length > 0) {
1191
1214
  this.originItems.forEach(function (origin) {
@@ -1204,18 +1227,23 @@
1204
1227
  }
1205
1228
  };
1206
1229
  GanttUpper.prototype.setupExpandedState = function () {
1207
- var _this = this;
1230
+ this.originItems = uniqBy(this.originItems, 'id');
1208
1231
  var items = [];
1232
+ var flatOriginItems = getFlatItems(this.originItems);
1209
1233
  if (this.items.length > 0) {
1210
1234
  items = recursiveItems(this.items);
1211
1235
  }
1212
1236
  else {
1213
1237
  items = flatten(this.groups.map(function (group) { return recursiveItems(group.items); }));
1214
1238
  }
1215
- this.expandedItemIds = [];
1216
1239
  items.forEach(function (item) {
1217
1240
  if (item.origin.expanded) {
1218
- _this.expandedItemIds.push(item.id);
1241
+ var newItem = flatOriginItems.find(function (originItem) { return originItem.id === item.id; });
1242
+ if (newItem) {
1243
+ if (newItem.expanded === undefined) {
1244
+ newItem.expanded = true;
1245
+ }
1246
+ }
1219
1247
  }
1220
1248
  });
1221
1249
  };
@@ -1246,18 +1274,24 @@
1246
1274
  };
1247
1275
  GanttUpper.prototype.computeRefs = function () {
1248
1276
  var _this = this;
1249
- if (this.computeAllRefs) {
1250
- this.groups.forEach(function (group) {
1251
- var groupItems = recursiveItems(group.items);
1252
- _this.computeItemsRefs.apply(_this, __spreadArray([], __read(groupItems)));
1253
- });
1254
- var items = recursiveItems(this.items);
1255
- this.computeItemsRefs.apply(this, __spreadArray([], __read(items)));
1256
- }
1277
+ this.groups.forEach(function (group) {
1278
+ var groupItems = recursiveItems(group.items);
1279
+ _this.computeItemsRefs.apply(_this, __spreadArray([], __read(groupItems)));
1280
+ });
1281
+ var items = recursiveItems(this.items);
1282
+ this.computeItemsRefs.apply(this, __spreadArray([], __read(items)));
1283
+ };
1284
+ GanttUpper.prototype.expandGroups = function (expanded) {
1285
+ this.groups.forEach(function (group) {
1286
+ group.setExpand(expanded);
1287
+ });
1288
+ this.expandChange.next();
1289
+ this.cdr.detectChanges();
1257
1290
  };
1258
1291
  GanttUpper.prototype.onInit = function () {
1259
1292
  var _this = this;
1260
1293
  this.styles = Object.assign({}, defaultStyles, this.styles);
1294
+ this.viewOptions.dateFormat = Object.assign({}, defaultConfig.dateFormat, this.config.dateFormat, this.viewOptions.dateFormat);
1261
1295
  this.createView();
1262
1296
  this.setupGroups();
1263
1297
  this.setupItems();
@@ -1268,6 +1302,9 @@
1268
1302
  _this.dragContainer.dragStarted.subscribe(function (event) {
1269
1303
  _this.dragStarted.emit(event);
1270
1304
  });
1305
+ _this.dragContainer.dragMoved.subscribe(function (event) {
1306
+ _this.dragMoved.emit(event);
1307
+ });
1271
1308
  _this.dragContainer.dragEnded.subscribe(function (event) {
1272
1309
  _this.dragEnded.emit(event);
1273
1310
  _this.computeRefs();
@@ -1313,19 +1350,49 @@
1313
1350
  });
1314
1351
  });
1315
1352
  };
1316
- GanttUpper.prototype.trackBy = function (item, index) {
1353
+ GanttUpper.prototype.trackBy = function (index, item) {
1317
1354
  return item.id || index;
1318
1355
  };
1319
1356
  GanttUpper.prototype.detectChanges = function () {
1320
1357
  this.cdr.detectChanges();
1321
1358
  };
1359
+ GanttUpper.prototype.expandGroup = function (group) {
1360
+ group.setExpand(!group.expanded);
1361
+ this.expandChange.emit();
1362
+ this.cdr.detectChanges();
1363
+ };
1364
+ // public functions
1365
+ GanttUpper.prototype.expandAll = function () {
1366
+ this.expandGroups(true);
1367
+ };
1368
+ GanttUpper.prototype.collapseAll = function () {
1369
+ this.expandGroups(false);
1370
+ };
1371
+ GanttUpper.prototype.getGanttItem = function (id) {
1372
+ return this.getGanttItems([id])[0] || null;
1373
+ };
1374
+ GanttUpper.prototype.getGanttItems = function (ids) {
1375
+ var items = [];
1376
+ if (this.items.length > 0) {
1377
+ items = recursiveItems(this.items);
1378
+ }
1379
+ else {
1380
+ items = flatten(this.groups.map(function (group) { return recursiveItems(group.items); }));
1381
+ }
1382
+ return items.filter(function (item) { return ids.includes(item.id); });
1383
+ };
1322
1384
  return GanttUpper;
1323
1385
  }());
1324
- 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 });
1325
- 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 });
1386
+ 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 }, { token: GANTT_GLOBAL_CONFIG }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1387
+ 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", dragMoved: "dragMoved", 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 });
1326
1388
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttUpper, decorators: [{
1327
1389
  type: i0.Directive
1328
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }]; }, propDecorators: { originItems: [{
1390
+ }], ctorParameters: function () {
1391
+ return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }, { type: undefined, decorators: [{
1392
+ type: i0.Inject,
1393
+ args: [GANTT_GLOBAL_CONFIG]
1394
+ }] }];
1395
+ }, propDecorators: { originItems: [{
1329
1396
  type: i0.Input,
1330
1397
  args: ['items']
1331
1398
  }], originGroups: [{
@@ -1351,6 +1418,8 @@
1351
1418
  type: i0.Output
1352
1419
  }], dragStarted: [{
1353
1420
  type: i0.Output
1421
+ }], dragMoved: [{
1422
+ type: i0.Output
1354
1423
  }], dragEnded: [{
1355
1424
  type: i0.Output
1356
1425
  }], barClick: [{
@@ -1423,7 +1492,7 @@
1423
1492
  return NgxGanttTableComponent;
1424
1493
  }());
1425
1494
  NgxGanttTableComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttTableComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1426
- 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 });
1495
+ NgxGanttTableComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: NgxGanttTableComponent, selector: "ngx-gantt-table", outputs: { columnChanges: "columnChanges" }, queries: [{ propertyName: "rowBeforeTemplate", first: true, predicate: ["rowBeforeSlot"], descendants: true, static: true }, { propertyName: "rowAfterTemplate", first: true, predicate: ["rowAfterSlot"], descendants: true, static: true }], ngImport: i0__namespace, template: '', isInline: true });
1427
1496
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttTableComponent, decorators: [{
1428
1497
  type: i0.Component,
1429
1498
  args: [{
@@ -1432,208 +1501,167 @@
1432
1501
  }]
1433
1502
  }], ctorParameters: function () { return []; }, propDecorators: { columnChanges: [{
1434
1503
  type: i0.Output
1504
+ }], rowBeforeTemplate: [{
1505
+ type: i0.ContentChild,
1506
+ args: ['rowBeforeSlot', { static: true }]
1507
+ }], rowAfterTemplate: [{
1508
+ type: i0.ContentChild,
1509
+ args: ['rowAfterSlot', { static: true }]
1435
1510
  }] } });
1436
1511
 
1437
- var scrollThreshold = 50;
1438
- var ScrollDirection;
1439
- (function (ScrollDirection) {
1440
- ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1441
- ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1442
- ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1443
- })(ScrollDirection || (ScrollDirection = {}));
1444
- var GanttDomService = /** @class */ (function () {
1445
- function GanttDomService() {
1446
- this.unsubscribe$ = new rxjs.Subject();
1447
- }
1448
- GanttDomService.prototype.monitorScrollChange = function () {
1449
- var _this = this;
1450
- rxjs.merge(rxjs.fromEvent(this.mainContainer, 'scroll'), rxjs.fromEvent(this.sideContainer, 'scroll'))
1451
- .pipe(operators.takeUntil(this.unsubscribe$))
1452
- .subscribe(function (event) {
1453
- _this.syncScroll(event);
1454
- });
1455
- rxjs.fromEvent(this.mainContainer, 'scroll')
1456
- .pipe(operators.startWith(), operators.takeUntil(this.unsubscribe$))
1457
- .subscribe(function (event) {
1458
- // if (this.mainContainer.scrollLeft > 0) {
1459
- // this.side.classList.add('gantt-side-has-shadow');
1460
- // } else {
1461
- // this.side.classList.remove('gantt-side-has-shadow');
1462
- // }
1463
- });
1464
- };
1465
- GanttDomService.prototype.syncScroll = function (event) {
1466
- var target = event.currentTarget;
1467
- this.calendarHeader.scrollLeft = this.mainContainer.scrollLeft;
1468
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1469
- this.sideContainer.scrollTop = target.scrollTop;
1470
- this.mainContainer.scrollTop = target.scrollTop;
1471
- };
1472
- GanttDomService.prototype.disableBrowserWheelEvent = function () {
1473
- var container = this.mainContainer;
1474
- rxjs.fromEvent(container, 'wheel')
1475
- .pipe(operators.takeUntil(this.unsubscribe$))
1476
- .subscribe(function (event) {
1477
- var delta = event.deltaX;
1478
- if (!delta) {
1479
- return;
1480
- }
1481
- if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1482
- (container.scrollLeft === 0 && delta < 0)) {
1483
- event.preventDefault();
1484
- }
1485
- });
1486
- };
1487
- GanttDomService.prototype.initialize = function (root) {
1488
- this.root = root.nativeElement;
1489
- this.side = this.root.getElementsByClassName('gantt-side')[0];
1490
- this.container = this.root.getElementsByClassName('gantt-container')[0];
1491
- this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
1492
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1493
- this.calendarHeader = this.root.getElementsByClassName('gantt-calendar-header')[0];
1494
- this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-grid')[0];
1495
- this.monitorScrollChange();
1496
- this.disableBrowserWheelEvent();
1497
- };
1498
- GanttDomService.prototype.getViewerScroll = function () {
1499
- var _this = this;
1500
- return rxjs.fromEvent(this.mainContainer, 'scroll').pipe(operators.map(function () { return _this.mainContainer.scrollLeft; }), operators.pairwise(), operators.map(function (_a) {
1501
- var _b = __read(_a, 2), previous = _b[0], current = _b[1];
1502
- var event = {
1503
- target: _this.mainContainer,
1504
- direction: ScrollDirection.NONE
1505
- };
1506
- if (current - previous < 0) {
1507
- if (_this.mainContainer.scrollLeft < scrollThreshold && _this.mainContainer.scrollLeft > 0) {
1508
- event.direction = ScrollDirection.LEFT;
1509
- }
1510
- }
1511
- if (current - previous > 0) {
1512
- if (_this.mainContainer.scrollWidth - _this.mainContainer.clientWidth - _this.mainContainer.scrollLeft < scrollThreshold) {
1513
- event.direction = ScrollDirection.RIGHT;
1514
- }
1515
- }
1516
- return event;
1517
- }));
1518
- };
1519
- GanttDomService.prototype.getResize = function () {
1520
- return rxjs.fromEvent(window, 'resize').pipe(operators.auditTime(150));
1521
- };
1522
- GanttDomService.prototype.scrollMainContainer = function (left) {
1523
- if (isNumber(left)) {
1524
- var scrollLeft = left - this.mainContainer.clientWidth / 2;
1525
- this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
1526
- this.calendarHeader.scrollLeft = this.mainContainer.scrollLeft;
1527
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1528
- }
1529
- };
1530
- GanttDomService.prototype.ngOnDestroy = function () {
1531
- this.unsubscribe$.next();
1532
- this.unsubscribe$.complete();
1533
- };
1534
- return GanttDomService;
1535
- }());
1536
- GanttDomService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1537
- GanttDomService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService });
1538
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService, decorators: [{
1539
- type: i0.Injectable
1540
- }], ctorParameters: function () { return []; } });
1541
-
1542
- var GanttDragContainer = /** @class */ (function () {
1543
- function GanttDragContainer() {
1544
- this.dragStarted = new i0.EventEmitter();
1545
- this.dragEnded = new i0.EventEmitter();
1546
- this.linkDragStarted = new i0.EventEmitter();
1547
- this.linkDragEntered = new i0.EventEmitter();
1548
- this.linkDragEnded = new i0.EventEmitter();
1549
- }
1550
- GanttDragContainer.prototype.emitLinkDragStarted = function (from, item) {
1551
- this.linkDraggingId = item.id;
1552
- this.linkDragFrom = from;
1553
- this.linkDragSource = this.linkDragFrom === 'source' ? item : null;
1554
- this.linkDragTarget = this.linkDragFrom === 'target' ? item : null;
1555
- this.linkDragStarted.emit({
1556
- source: this.linkDragSource && this.linkDragSource.origin,
1557
- target: this.linkDragTarget && this.linkDragTarget.origin
1558
- });
1559
- };
1560
- GanttDragContainer.prototype.emitLinkDragEntered = function (item) {
1561
- if (this.linkDragFrom === 'source') {
1562
- this.linkDragTarget = item;
1563
- }
1564
- else {
1565
- this.linkDragSource = item;
1566
- }
1567
- this.linkDragEntered.emit({
1568
- source: this.linkDragSource.origin,
1569
- target: this.linkDragTarget.origin
1570
- });
1571
- };
1572
- GanttDragContainer.prototype.emitLinkDragLeaved = function () {
1573
- if (this.linkDragFrom === 'source') {
1574
- this.linkDragTarget = null;
1575
- }
1576
- else {
1577
- this.linkDragSource = null;
1578
- }
1579
- };
1580
- GanttDragContainer.prototype.emitLinkDragEnded = function () {
1581
- this.linkDraggingId = null;
1582
- if (this.linkDragSource && this.linkDragTarget) {
1583
- this.linkDragSource.addLink(this.linkDragTarget.id);
1584
- this.linkDragEnded.emit({
1585
- source: this.linkDragSource.origin,
1586
- target: this.linkDragTarget.origin
1587
- });
1588
- }
1589
- this.linkDragSource = null;
1590
- this.linkDragTarget = null;
1591
- };
1592
- return GanttDragContainer;
1593
- }());
1594
- GanttDragContainer.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1595
- GanttDragContainer.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer });
1596
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer, decorators: [{
1597
- type: i0.Injectable
1598
- }], ctorParameters: function () { return []; } });
1599
-
1600
1512
  var GANTT_ABSTRACT_TOKEN = new i0.InjectionToken('gantt-abstract-token');
1601
1513
 
1602
- var defaultColumnWidth = 100;
1603
- var minColumnWidth = 80;
1604
- var GanttTableHeaderComponent = /** @class */ (function () {
1605
- function GanttTableHeaderComponent(elementRef, gantt) {
1514
+ 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>";
1515
+ 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>";
1516
+ 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>";
1517
+ 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>";
1518
+ 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>";
1519
+ 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>";
1520
+ var icons = {
1521
+ 'angle-right': angleRight,
1522
+ 'angle-down': angleDown,
1523
+ 'plus-square': plusSquare,
1524
+ 'minus-square': minusSquare,
1525
+ loading: loadingIcon,
1526
+ empty: emptyIcon
1527
+ };
1528
+
1529
+ var GanttIconComponent = /** @class */ (function () {
1530
+ function GanttIconComponent(elementRef) {
1606
1531
  this.elementRef = elementRef;
1607
- this.gantt = gantt;
1608
- this.tableWidth = 0;
1609
- this.className = "gantt-table-header gantt-table-row";
1532
+ this.isIcon = true;
1610
1533
  }
1611
- Object.defineProperty(GanttTableHeaderComponent.prototype, "columns", {
1612
- set: function (columns) {
1613
- columns.forEach(function (column) {
1614
- if (!column.columnWidth) {
1615
- column.columnWidth = coercion.coerceCssPixelValue(defaultColumnWidth);
1616
- }
1617
- });
1618
- this.columnList = columns;
1534
+ Object.defineProperty(GanttIconComponent.prototype, "iconName", {
1535
+ set: function (name) {
1536
+ this.setSvg(name);
1619
1537
  },
1620
1538
  enumerable: false,
1621
1539
  configurable: true
1622
1540
  });
1623
- GanttTableHeaderComponent.prototype.ngOnInit = function () { };
1624
- GanttTableHeaderComponent.prototype.ngAfterViewInit = function () {
1625
- this.tableWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
1626
- };
1627
- GanttTableHeaderComponent.prototype.dragFixed = function (config) {
1541
+ GanttIconComponent.prototype.ngOnInit = function () { };
1542
+ GanttIconComponent.prototype.ngAfterViewInit = function () { };
1543
+ GanttIconComponent.prototype.setSvg = function (name) {
1544
+ var iconSvg = icons[name];
1545
+ if (iconSvg) {
1546
+ this.elementRef.nativeElement.innerHTML = iconSvg;
1547
+ }
1548
+ else {
1549
+ this.elementRef.nativeElement.innerHTML = '';
1550
+ }
1551
+ };
1552
+ return GanttIconComponent;
1553
+ }());
1554
+ 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 });
1555
+ 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 });
1556
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttIconComponent, decorators: [{
1557
+ type: i0.Component,
1558
+ args: [{
1559
+ selector: 'gantt-icon',
1560
+ template: ''
1561
+ }]
1562
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { isIcon: [{
1563
+ type: i0.HostBinding,
1564
+ args: ['class.gantt-icon']
1565
+ }], iconName: [{
1566
+ type: i0.Input
1567
+ }] } });
1568
+
1569
+ var IsGanttRangeItemPipe = /** @class */ (function () {
1570
+ function IsGanttRangeItemPipe() {
1571
+ }
1572
+ IsGanttRangeItemPipe.prototype.transform = function (value) {
1573
+ return value === exports.GanttItemType.range;
1574
+ };
1575
+ return IsGanttRangeItemPipe;
1576
+ }());
1577
+ IsGanttRangeItemPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttRangeItemPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1578
+ IsGanttRangeItemPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1579
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttRangeItemPipe, decorators: [{
1580
+ type: i0.Pipe,
1581
+ args: [{
1582
+ name: 'isGanttRangeItem'
1583
+ }]
1584
+ }] });
1585
+ var IsGanttBarItemPipe = /** @class */ (function () {
1586
+ function IsGanttBarItemPipe() {
1587
+ }
1588
+ IsGanttBarItemPipe.prototype.transform = function (value) {
1589
+ return value === exports.GanttItemType.bar;
1590
+ };
1591
+ return IsGanttBarItemPipe;
1592
+ }());
1593
+ IsGanttBarItemPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttBarItemPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1594
+ IsGanttBarItemPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1595
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttBarItemPipe, decorators: [{
1596
+ type: i0.Pipe,
1597
+ args: [{
1598
+ name: 'isGanttBarItem'
1599
+ }]
1600
+ }] });
1601
+ var IsGanttCustomItemPipe = /** @class */ (function () {
1602
+ function IsGanttCustomItemPipe() {
1603
+ }
1604
+ IsGanttCustomItemPipe.prototype.transform = function (value) {
1605
+ return value === exports.GanttItemType.custom;
1606
+ };
1607
+ return IsGanttCustomItemPipe;
1608
+ }());
1609
+ IsGanttCustomItemPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttCustomItemPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1610
+ IsGanttCustomItemPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1611
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttCustomItemPipe, decorators: [{
1612
+ type: i0.Pipe,
1613
+ args: [{
1614
+ name: 'isGanttCustomItem'
1615
+ }]
1616
+ }] });
1617
+
1618
+ var defaultColumnWidth = 100;
1619
+ var minColumnWidth = 80;
1620
+ var GanttTableComponent = /** @class */ (function () {
1621
+ function GanttTableComponent(gantt, elementRef) {
1622
+ this.gantt = gantt;
1623
+ this.elementRef = elementRef;
1624
+ this.ganttTableClass = true;
1625
+ this.ganttTableEmptyClass = false;
1626
+ }
1627
+ Object.defineProperty(GanttTableComponent.prototype, "columns", {
1628
+ set: function (columns) {
1629
+ columns.forEach(function (column) {
1630
+ if (!column.columnWidth) {
1631
+ column.columnWidth = coercion.coerceCssPixelValue(defaultColumnWidth);
1632
+ }
1633
+ });
1634
+ this.columnList = columns;
1635
+ },
1636
+ enumerable: false,
1637
+ configurable: true
1638
+ });
1639
+ GanttTableComponent.prototype.ngOnInit = function () { };
1640
+ GanttTableComponent.prototype.ngOnChanges = function (changes) {
1641
+ var _a, _b;
1642
+ 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)) {
1643
+ this.ganttTableEmptyClass = true;
1644
+ }
1645
+ else {
1646
+ this.ganttTableEmptyClass = false;
1647
+ }
1648
+ };
1649
+ GanttTableComponent.prototype.dragFixed = function (config) {
1628
1650
  if (config.movedWidth < config.minWidth) {
1629
1651
  config.target.style.transform = "translate3d(" + (config.minWidth - config.originWidth) + "px, 0, 0)";
1630
1652
  }
1631
1653
  };
1632
- GanttTableHeaderComponent.prototype.dragStarted = function (event) {
1654
+ GanttTableComponent.prototype.expandGroup = function (group) {
1655
+ this.gantt.expandGroup(group);
1656
+ };
1657
+ GanttTableComponent.prototype.expandChildren = function (item) {
1658
+ this.gantt.expandChildren(item);
1659
+ };
1660
+ GanttTableComponent.prototype.dragStarted = function (event) {
1633
1661
  var target = event.source.element.nativeElement;
1634
1662
  this.dragStartLeft = target.getBoundingClientRect().left;
1635
1663
  };
1636
- GanttTableHeaderComponent.prototype.dragMoved = function (event, column) {
1664
+ GanttTableComponent.prototype.dragMoved = function (event, column) {
1637
1665
  var target = event.source.element.nativeElement;
1638
1666
  var left = target.getBoundingClientRect().left;
1639
1667
  var originWidth;
@@ -1657,8 +1685,7 @@
1657
1685
  });
1658
1686
  this.showAuxiliaryLine(event);
1659
1687
  };
1660
- GanttTableHeaderComponent.prototype.columnDragEnded = function (event, column) {
1661
- var beforeWidth = parseInt(column.columnWidth, 10);
1688
+ GanttTableComponent.prototype.columnDragEnded = function (event, column) {
1662
1689
  var target = event.source.element.nativeElement;
1663
1690
  var left = target.getBoundingClientRect().left;
1664
1691
  var width = parseInt(column.columnWidth, 10) + (left - this.dragStartLeft);
@@ -1667,161 +1694,336 @@
1667
1694
  if (this.gantt.table) {
1668
1695
  this.gantt.table.columnChanges.emit({ columns: this.columnList });
1669
1696
  }
1670
- this.tableWidth = this.tableWidth - beforeWidth + columnWidth;
1671
1697
  this.hideAuxiliaryLine();
1672
1698
  event.source.reset();
1673
1699
  };
1674
- GanttTableHeaderComponent.prototype.tableDragEnded = function (event) {
1700
+ GanttTableComponent.prototype.tableDragEnded = function (event) {
1675
1701
  var target = event.source.element.nativeElement;
1676
1702
  var left = target.getBoundingClientRect().left;
1677
1703
  var tableWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
1678
1704
  var dragWidth = left - this.dragStartLeft;
1679
- var tempWidth = 0;
1680
1705
  this.columnList.forEach(function (column) {
1681
1706
  var lastColumnWidth = parseInt(column.columnWidth, 10);
1682
1707
  var distributeWidth = parseInt(String(dragWidth * (lastColumnWidth / tableWidth)), 10);
1683
1708
  var columnWidth = Math.max(lastColumnWidth + distributeWidth || 0, minColumnWidth);
1684
1709
  column.columnWidth = coercion.coerceCssPixelValue(columnWidth);
1685
- tempWidth += columnWidth;
1686
1710
  });
1687
- this.tableWidth = tempWidth;
1688
1711
  if (this.gantt.table) {
1689
1712
  this.gantt.table.columnChanges.emit({ columns: this.columnList });
1690
1713
  }
1691
1714
  this.hideAuxiliaryLine();
1692
1715
  event.source.reset();
1693
1716
  };
1694
- GanttTableHeaderComponent.prototype.showAuxiliaryLine = function (event) {
1717
+ GanttTableComponent.prototype.showAuxiliaryLine = function (event) {
1695
1718
  var tableRect = this.elementRef.nativeElement.getBoundingClientRect();
1696
1719
  var targetRect = event.source.element.nativeElement.getBoundingClientRect();
1697
1720
  var distance = { x: targetRect.left - tableRect.left, y: targetRect.top - tableRect.top };
1698
1721
  this.draglineElementRef.nativeElement.style.left = distance.x + "px";
1699
1722
  this.draglineElementRef.nativeElement.style.display = 'block';
1700
1723
  };
1701
- GanttTableHeaderComponent.prototype.hideAuxiliaryLine = function () {
1724
+ GanttTableComponent.prototype.hideAuxiliaryLine = function () {
1702
1725
  this.draglineElementRef.nativeElement.style.display = 'none';
1703
1726
  };
1704
- return GanttTableHeaderComponent;
1727
+ GanttTableComponent.prototype.trackBy = function (index, item) {
1728
+ return item.id || index;
1729
+ };
1730
+ return GanttTableComponent;
1705
1731
  }());
1706
- GanttTableHeaderComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttTableHeaderComponent, deps: [{ token: i0__namespace.ElementRef }, { token: GANTT_ABSTRACT_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Component });
1707
- GanttTableHeaderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttTableHeaderComponent, selector: "gantt-table-header", inputs: { columns: "columns" }, host: { properties: { "class": "this.className" } }, viewQueries: [{ propertyName: "draglineElementRef", first: true, predicate: ["dragLine"], descendants: true, static: true }], ngImport: i0__namespace, template: "<div\n class=\"gantt-table-column\"\n [class.border-right-0]=\"i === columnList.length - 1\"\n *ngFor=\"let column of columnList; let i = index\"\n [style.width]=\"column.columnWidth\"\n>\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=\"column-drag-trigger 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\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", directives: [{ type: i1__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1__namespace$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragDisabled", "cdkDragStartDelay", "cdkDragLockAxis", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragBoundary", "cdkDragRootElement", "cdkDragPreviewContainer", "cdkDragData", "cdkDragFreeDragPosition"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }] });
1708
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttTableHeaderComponent, decorators: [{
1732
+ 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 });
1733
+ 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", rowBeforeTemplate: "rowBeforeTemplate", rowAfterTemplate: "rowAfterTemplate" }, 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; trackBy: trackBy\">\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; trackBy: trackBy\">\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 <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\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 <ng-template\n [ngTemplateOutlet]=\"rowAfterTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\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 } });
1734
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttTableComponent, decorators: [{
1709
1735
  type: i0.Component,
1710
1736
  args: [{
1711
- selector: 'gantt-table-header',
1712
- templateUrl: './gantt-table-header.component.html'
1737
+ selector: 'gantt-table',
1738
+ templateUrl: './gantt-table.component.html'
1713
1739
  }]
1714
1740
  }], ctorParameters: function () {
1715
- return [{ type: i0__namespace.ElementRef }, { type: undefined, decorators: [{
1741
+ return [{ type: undefined, decorators: [{
1716
1742
  type: i0.Inject,
1717
1743
  args: [GANTT_ABSTRACT_TOKEN]
1718
- }] }];
1719
- }, propDecorators: { columns: [{
1744
+ }] }, { type: i0__namespace.ElementRef }];
1745
+ }, propDecorators: { groups: [{
1746
+ type: i0.Input
1747
+ }], items: [{
1748
+ type: i0.Input
1749
+ }], columns: [{
1750
+ type: i0.Input
1751
+ }], groupTemplate: [{
1752
+ type: i0.Input
1753
+ }], emptyTemplate: [{
1754
+ type: i0.Input
1755
+ }], rowBeforeTemplate: [{
1756
+ type: i0.Input
1757
+ }], rowAfterTemplate: [{
1720
1758
  type: i0.Input
1721
1759
  }], draglineElementRef: [{
1722
1760
  type: i0.ViewChild,
1723
1761
  args: ['dragLine', { static: true }]
1724
- }], className: [{
1762
+ }], ganttTableClass: [{
1763
+ type: i0.HostBinding,
1764
+ args: ['class.gantt-table']
1765
+ }], ganttTableEmptyClass: [{
1725
1766
  type: i0.HostBinding,
1726
- args: ['class']
1767
+ args: ['class.gantt-table-empty']
1727
1768
  }] } });
1728
1769
 
1729
- var GanttPrintService = /** @class */ (function () {
1730
- function GanttPrintService() {
1770
+ var scrollThreshold = 50;
1771
+ var ScrollDirection;
1772
+ (function (ScrollDirection) {
1773
+ ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1774
+ ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1775
+ ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1776
+ })(ScrollDirection || (ScrollDirection = {}));
1777
+ var GanttDomService = /** @class */ (function () {
1778
+ function GanttDomService() {
1779
+ this.unsubscribe$ = new rxjs.Subject();
1731
1780
  }
1732
- GanttPrintService.prototype.setInlineStyles = function (targetElem) {
1733
- var e_1, _a;
1734
- var svgElements = Array.from(targetElem.getElementsByTagName('svg'));
1735
- try {
1736
- for (var svgElements_1 = __values(svgElements), svgElements_1_1 = svgElements_1.next(); !svgElements_1_1.done; svgElements_1_1 = svgElements_1.next()) {
1737
- var svgElement = svgElements_1_1.value;
1738
- this.recursElementChildren(svgElement);
1739
- }
1740
- }
1741
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1742
- finally {
1743
- try {
1744
- if (svgElements_1_1 && !svgElements_1_1.done && (_a = svgElements_1.return)) _a.call(svgElements_1);
1745
- }
1746
- finally { if (e_1) throw e_1.error; }
1747
- }
1781
+ GanttDomService.prototype.monitorScrollChange = function () {
1782
+ var _this = this;
1783
+ rxjs.merge(rxjs.fromEvent(this.mainContainer, 'scroll'), rxjs.fromEvent(this.sideContainer, 'scroll'))
1784
+ .pipe(operators.takeUntil(this.unsubscribe$))
1785
+ .subscribe(function (event) {
1786
+ _this.syncScroll(event);
1787
+ });
1788
+ rxjs.fromEvent(this.mainContainer, 'scroll')
1789
+ .pipe(operators.startWith(), operators.takeUntil(this.unsubscribe$))
1790
+ .subscribe(function (event) {
1791
+ // if (this.mainContainer.scrollLeft > 0) {
1792
+ // this.side.classList.add('gantt-side-has-shadow');
1793
+ // } else {
1794
+ // this.side.classList.remove('gantt-side-has-shadow');
1795
+ // }
1796
+ });
1748
1797
  };
1749
- GanttPrintService.prototype.recursElementChildren = function (node) {
1750
- var e_2, _a, e_3, _b;
1751
- var transformProperties = [
1752
- 'fill',
1753
- 'color',
1754
- 'font-size',
1755
- 'stroke',
1756
- 'font',
1757
- 'text-anchor',
1758
- 'stroke-dasharray',
1759
- 'shape-rendering',
1760
- 'stroke-width'
1761
- ];
1762
- if (!node.style) {
1763
- return;
1764
- }
1765
- var styles = getComputedStyle(node);
1766
- try {
1767
- for (var transformProperties_1 = __values(transformProperties), transformProperties_1_1 = transformProperties_1.next(); !transformProperties_1_1.done; transformProperties_1_1 = transformProperties_1.next()) {
1768
- var transformProperty = transformProperties_1_1.value;
1769
- node.style[transformProperty] = styles[transformProperty];
1770
- }
1771
- }
1772
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1773
- finally {
1774
- try {
1775
- if (transformProperties_1_1 && !transformProperties_1_1.done && (_a = transformProperties_1.return)) _a.call(transformProperties_1);
1776
- }
1777
- finally { if (e_2) throw e_2.error; }
1778
- }
1779
- try {
1780
- for (var _c = __values(Array.from(node.childNodes)), _d = _c.next(); !_d.done; _d = _c.next()) {
1781
- var child = _d.value;
1782
- this.recursElementChildren(child);
1798
+ GanttDomService.prototype.syncScroll = function (event) {
1799
+ var target = event.currentTarget;
1800
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1801
+ this.sideContainer.scrollTop = target.scrollTop;
1802
+ this.mainContainer.scrollTop = target.scrollTop;
1803
+ };
1804
+ GanttDomService.prototype.disableBrowserWheelEvent = function () {
1805
+ var container = this.mainContainer;
1806
+ rxjs.fromEvent(container, 'wheel')
1807
+ .pipe(operators.takeUntil(this.unsubscribe$))
1808
+ .subscribe(function (event) {
1809
+ var delta = event.deltaX;
1810
+ if (!delta) {
1811
+ return;
1783
1812
  }
1784
- }
1785
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1786
- finally {
1787
- try {
1788
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
1813
+ if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1814
+ (container.scrollLeft === 0 && delta < 0)) {
1815
+ event.preventDefault();
1789
1816
  }
1790
- finally { if (e_3) throw e_3.error; }
1791
- }
1817
+ });
1792
1818
  };
1793
- GanttPrintService.prototype.register = function (root) {
1819
+ GanttDomService.prototype.initialize = function (root) {
1794
1820
  this.root = root.nativeElement;
1821
+ this.side = this.root.getElementsByClassName('gantt-side')[0];
1822
+ this.container = this.root.getElementsByClassName('gantt-container')[0];
1823
+ this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
1795
1824
  this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1825
+ this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-overlay')[0];
1826
+ this.monitorScrollChange();
1827
+ this.disableBrowserWheelEvent();
1796
1828
  };
1797
- GanttPrintService.prototype.print = function (name, ignoreElementClass) {
1829
+ GanttDomService.prototype.getViewerScroll = function () {
1798
1830
  var _this = this;
1799
- if (name === void 0) { name = 'download'; }
1800
- var root = this.root;
1801
- var mainContainer = this.mainContainer;
1802
- // set print width
1803
- var printWidth = root.offsetWidth;
1804
- // set print height
1805
- var printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
1806
- html2canvas__default['default'](root, {
1807
- logging: false,
1808
- allowTaint: true,
1809
- useCORS: true,
1810
- width: printWidth,
1811
- height: printHeight,
1812
- ignoreElements: function (element) {
1813
- if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
1814
- return true;
1815
- }
1816
- if (element.classList.contains('gantt-calendar-today-overlay')) {
1817
- return true;
1818
- }
1819
- },
1820
- onclone: function (cloneDocument) {
1821
- var ganttClass = root.className;
1831
+ return rxjs.fromEvent(this.mainContainer, 'scroll').pipe(operators.map(function () { return _this.mainContainer.scrollLeft; }), operators.pairwise(), operators.map(function (_a) {
1832
+ var _b = __read(_a, 2), previous = _b[0], current = _b[1];
1833
+ var event = {
1834
+ target: _this.mainContainer,
1835
+ direction: ScrollDirection.NONE
1836
+ };
1837
+ if (current - previous < 0) {
1838
+ if (_this.mainContainer.scrollLeft < scrollThreshold && _this.mainContainer.scrollLeft > 0) {
1839
+ event.direction = ScrollDirection.LEFT;
1840
+ }
1841
+ }
1842
+ if (current - previous > 0) {
1843
+ if (_this.mainContainer.scrollWidth - _this.mainContainer.clientWidth - _this.mainContainer.scrollLeft < scrollThreshold) {
1844
+ event.direction = ScrollDirection.RIGHT;
1845
+ }
1846
+ }
1847
+ return event;
1848
+ }));
1849
+ };
1850
+ GanttDomService.prototype.getResize = function () {
1851
+ return rxjs.fromEvent(window, 'resize').pipe(operators.auditTime(150));
1852
+ };
1853
+ GanttDomService.prototype.scrollMainContainer = function (left) {
1854
+ if (isNumber(left)) {
1855
+ var scrollLeft = left - this.mainContainer.clientWidth / 2;
1856
+ this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
1857
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1858
+ }
1859
+ };
1860
+ GanttDomService.prototype.ngOnDestroy = function () {
1861
+ this.unsubscribe$.next();
1862
+ this.unsubscribe$.complete();
1863
+ };
1864
+ return GanttDomService;
1865
+ }());
1866
+ GanttDomService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1867
+ GanttDomService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService });
1868
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService, decorators: [{
1869
+ type: i0.Injectable
1870
+ }], ctorParameters: function () { return []; } });
1871
+
1872
+ var GanttDragContainer = /** @class */ (function () {
1873
+ function GanttDragContainer() {
1874
+ this.dragStarted = new i0.EventEmitter();
1875
+ this.dragMoved = new i0.EventEmitter();
1876
+ this.dragEnded = new i0.EventEmitter();
1877
+ this.linkDragStarted = new i0.EventEmitter();
1878
+ this.linkDragEntered = new i0.EventEmitter();
1879
+ this.linkDragEnded = new i0.EventEmitter();
1880
+ }
1881
+ GanttDragContainer.prototype.emitLinkDragStarted = function (from, item) {
1882
+ this.linkDraggingId = item.id;
1883
+ this.linkDragFrom = from;
1884
+ this.linkDragSource = this.linkDragFrom === 'source' ? item : null;
1885
+ this.linkDragTarget = this.linkDragFrom === 'target' ? item : null;
1886
+ this.linkDragStarted.emit({
1887
+ source: this.linkDragSource && this.linkDragSource.origin,
1888
+ target: this.linkDragTarget && this.linkDragTarget.origin
1889
+ });
1890
+ };
1891
+ GanttDragContainer.prototype.emitLinkDragEntered = function (item) {
1892
+ if (this.linkDragFrom === 'source') {
1893
+ this.linkDragTarget = item;
1894
+ }
1895
+ else {
1896
+ this.linkDragSource = item;
1897
+ }
1898
+ this.linkDragEntered.emit({
1899
+ source: this.linkDragSource.origin,
1900
+ target: this.linkDragTarget.origin
1901
+ });
1902
+ };
1903
+ GanttDragContainer.prototype.emitLinkDragLeaved = function () {
1904
+ if (this.linkDragFrom === 'source') {
1905
+ this.linkDragTarget = null;
1906
+ }
1907
+ else {
1908
+ this.linkDragSource = null;
1909
+ }
1910
+ };
1911
+ GanttDragContainer.prototype.emitLinkDragEnded = function () {
1912
+ this.linkDraggingId = null;
1913
+ if (this.linkDragSource && this.linkDragTarget) {
1914
+ this.linkDragSource.addLink(this.linkDragTarget.id);
1915
+ this.linkDragEnded.emit({
1916
+ source: this.linkDragSource.origin,
1917
+ target: this.linkDragTarget.origin
1918
+ });
1919
+ }
1920
+ this.linkDragSource = null;
1921
+ this.linkDragTarget = null;
1922
+ };
1923
+ return GanttDragContainer;
1924
+ }());
1925
+ GanttDragContainer.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1926
+ GanttDragContainer.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer });
1927
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer, decorators: [{
1928
+ type: i0.Injectable
1929
+ }], ctorParameters: function () { return []; } });
1930
+
1931
+ var GanttPrintService = /** @class */ (function () {
1932
+ function GanttPrintService() {
1933
+ }
1934
+ GanttPrintService.prototype.setInlineStyles = function (targetElem) {
1935
+ var e_1, _a;
1936
+ var svgElements = Array.from(targetElem.getElementsByTagName('svg'));
1937
+ try {
1938
+ for (var svgElements_1 = __values(svgElements), svgElements_1_1 = svgElements_1.next(); !svgElements_1_1.done; svgElements_1_1 = svgElements_1.next()) {
1939
+ var svgElement = svgElements_1_1.value;
1940
+ this.recursElementChildren(svgElement);
1941
+ }
1942
+ }
1943
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1944
+ finally {
1945
+ try {
1946
+ if (svgElements_1_1 && !svgElements_1_1.done && (_a = svgElements_1.return)) _a.call(svgElements_1);
1947
+ }
1948
+ finally { if (e_1) throw e_1.error; }
1949
+ }
1950
+ };
1951
+ GanttPrintService.prototype.recursElementChildren = function (node) {
1952
+ var e_2, _a, e_3, _b;
1953
+ var transformProperties = [
1954
+ 'fill',
1955
+ 'color',
1956
+ 'font-size',
1957
+ 'stroke',
1958
+ 'font',
1959
+ 'text-anchor',
1960
+ 'stroke-dasharray',
1961
+ 'shape-rendering',
1962
+ 'stroke-width'
1963
+ ];
1964
+ if (!node.style) {
1965
+ return;
1966
+ }
1967
+ var styles = getComputedStyle(node);
1968
+ try {
1969
+ for (var transformProperties_1 = __values(transformProperties), transformProperties_1_1 = transformProperties_1.next(); !transformProperties_1_1.done; transformProperties_1_1 = transformProperties_1.next()) {
1970
+ var transformProperty = transformProperties_1_1.value;
1971
+ node.style[transformProperty] = styles[transformProperty];
1972
+ }
1973
+ }
1974
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1975
+ finally {
1976
+ try {
1977
+ if (transformProperties_1_1 && !transformProperties_1_1.done && (_a = transformProperties_1.return)) _a.call(transformProperties_1);
1978
+ }
1979
+ finally { if (e_2) throw e_2.error; }
1980
+ }
1981
+ try {
1982
+ for (var _c = __values(Array.from(node.childNodes)), _d = _c.next(); !_d.done; _d = _c.next()) {
1983
+ var child = _d.value;
1984
+ this.recursElementChildren(child);
1985
+ }
1986
+ }
1987
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1988
+ finally {
1989
+ try {
1990
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
1991
+ }
1992
+ finally { if (e_3) throw e_3.error; }
1993
+ }
1994
+ };
1995
+ GanttPrintService.prototype.register = function (root) {
1996
+ this.root = root.nativeElement;
1997
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1998
+ };
1999
+ GanttPrintService.prototype.print = function (name, ignoreElementClass) {
2000
+ var _this = this;
2001
+ if (name === void 0) { name = 'download'; }
2002
+ var root = this.root;
2003
+ var mainContainer = this.mainContainer;
2004
+ // set print width
2005
+ var printWidth = root.offsetWidth;
2006
+ // set print height
2007
+ var printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
2008
+ html2canvas__default['default'](root, {
2009
+ logging: false,
2010
+ allowTaint: true,
2011
+ useCORS: true,
2012
+ width: printWidth,
2013
+ height: printHeight,
2014
+ ignoreElements: function (element) {
2015
+ if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
2016
+ return true;
2017
+ }
2018
+ if (element.classList.contains('gantt-calendar-today-overlay')) {
2019
+ return true;
2020
+ }
2021
+ },
2022
+ onclone: function (cloneDocument) {
2023
+ var ganttClass = root.className;
1822
2024
  var cloneGanttDom = cloneDocument.querySelector("." + ganttClass.replace(/\s+/g, '.'));
1823
2025
  var cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
1824
- var cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-grid-main');
2026
+ var cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
1825
2027
  var cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
1826
2028
  // change targetDom width
1827
2029
  cloneGanttDom.style.width = printWidth + "px";
@@ -1853,62 +2055,78 @@
1853
2055
  type: i0.Injectable
1854
2056
  }], ctorParameters: function () { return []; } });
1855
2057
 
1856
- var GanttCalendarHeaderComponent = /** @class */ (function () {
1857
- function GanttCalendarHeaderComponent(ganttUpper, ngZone, elementRef) {
2058
+ var mainHeight = 5000;
2059
+ var GanttCalendarComponent = /** @class */ (function () {
2060
+ function GanttCalendarComponent(ganttUpper, ngZone, elementRef) {
1858
2061
  this.ganttUpper = ganttUpper;
1859
2062
  this.ngZone = ngZone;
1860
2063
  this.elementRef = elementRef;
1861
2064
  this.unsubscribe$ = new rxjs.Subject();
1862
2065
  this.headerHeight = headerHeight;
2066
+ this.mainHeight = mainHeight;
2067
+ this.todayHeight = todayHeight;
2068
+ this.todayWidth = todayWidth;
2069
+ this.todayBorderRadius = todayBorderRadius;
1863
2070
  this.viewTypes = exports.GanttViewType;
1864
- this.className = "gantt-calendar gantt-calendar-header";
2071
+ this.className = true;
1865
2072
  }
1866
- Object.defineProperty(GanttCalendarHeaderComponent.prototype, "view", {
2073
+ Object.defineProperty(GanttCalendarComponent.prototype, "view", {
1867
2074
  get: function () {
1868
2075
  return this.ganttUpper.view;
1869
2076
  },
1870
2077
  enumerable: false,
1871
2078
  configurable: true
1872
2079
  });
1873
- GanttCalendarHeaderComponent.prototype.ngOnInit = function () {
1874
- var _this = this;
1875
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
1876
- rxjs.merge(_this.ganttUpper.viewChange, _this.ganttUpper.view.start$)
1877
- .pipe(operators.takeUntil(_this.unsubscribe$))
1878
- .subscribe(function () {
1879
- if (_this.ganttUpper.viewType === exports.GanttViewType.day)
1880
- _this.setTodayPoint();
1881
- });
1882
- });
1883
- };
1884
- GanttCalendarHeaderComponent.prototype.setTodayPoint = function () {
2080
+ GanttCalendarComponent.prototype.setTodayPoint = function () {
1885
2081
  var x = this.view.getTodayXPoint();
1886
2082
  var today = new GanttDate().getDate();
1887
2083
  var todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
1888
2084
  var rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
2085
+ var line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
1889
2086
  if (isNumber(x)) {
1890
2087
  if (rect) {
1891
2088
  rect.style.left = x - todayWidth / 2 + "px";
1892
2089
  rect.style.top = headerHeight - todayHeight + "px";
1893
2090
  rect.innerHTML = today.toString();
1894
2091
  }
2092
+ if (line) {
2093
+ line.style.left = x + "px";
2094
+ line.style.top = headerHeight + "px";
2095
+ line.style.bottom = -mainHeight + "px";
2096
+ }
1895
2097
  }
1896
2098
  else {
1897
2099
  todayEle.style.display = 'none';
1898
2100
  }
1899
2101
  };
1900
- GanttCalendarHeaderComponent.prototype.trackBy = function (point, index) {
2102
+ GanttCalendarComponent.prototype.ngOnInit = function () {
2103
+ var _this = this;
2104
+ this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
2105
+ rxjs.merge(_this.ganttUpper.viewChange, _this.ganttUpper.view.start$)
2106
+ .pipe(operators.takeUntil(_this.unsubscribe$))
2107
+ .subscribe(function () {
2108
+ _this.setTodayPoint();
2109
+ });
2110
+ });
2111
+ };
2112
+ GanttCalendarComponent.prototype.ngAfterViewInit = function () { };
2113
+ GanttCalendarComponent.prototype.ngOnChanges = function (changes) { };
2114
+ GanttCalendarComponent.prototype.trackBy = function (index, point) {
1901
2115
  return point.text || index;
1902
2116
  };
1903
- return GanttCalendarHeaderComponent;
2117
+ GanttCalendarComponent.prototype.ngOnDestroy = function () {
2118
+ this.unsubscribe$.next();
2119
+ this.unsubscribe$.complete();
2120
+ };
2121
+ return GanttCalendarComponent;
1904
2122
  }());
1905
- GanttCalendarHeaderComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttCalendarHeaderComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0__namespace.NgZone }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1906
- GanttCalendarHeaderComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header", host: { properties: { "class": "this.className" } }, 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</div>\n<svg [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]=\"headerHeight\"\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</svg>\n", directives: [{ type: i1__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1907
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttCalendarHeaderComponent, decorators: [{
2123
+ 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 });
2124
+ 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"] }] });
2125
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttCalendarComponent, decorators: [{
1908
2126
  type: i0.Component,
1909
2127
  args: [{
1910
- selector: 'gantt-calendar-header',
1911
- templateUrl: './calendar-header.component.html'
2128
+ selector: 'gantt-calendar-overlay',
2129
+ templateUrl: './calendar.component.html'
1912
2130
  }]
1913
2131
  }], ctorParameters: function () {
1914
2132
  return [{ type: GanttUpper, decorators: [{
@@ -1917,271 +2135,156 @@
1917
2135
  }] }, { type: i0__namespace.NgZone }, { type: i0__namespace.ElementRef }];
1918
2136
  }, propDecorators: { className: [{
1919
2137
  type: i0.HostBinding,
1920
- args: ['class']
1921
- }] } });
1922
-
1923
- 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>";
1924
- 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>";
1925
- 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>";
1926
- 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>";
1927
- 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>";
1928
- 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>";
1929
- var icons = {
1930
- 'angle-right': angleRight,
1931
- 'angle-down': angleDown,
1932
- 'plus-square': plusSquare,
1933
- 'minus-square': minusSquare,
1934
- loading: loadingIcon,
1935
- empty: emptyIcon
1936
- };
1937
-
1938
- var GanttIconComponent = /** @class */ (function () {
1939
- function GanttIconComponent(elementRef) {
1940
- this.elementRef = elementRef;
1941
- this.isIcon = true;
1942
- }
1943
- Object.defineProperty(GanttIconComponent.prototype, "iconName", {
1944
- set: function (name) {
1945
- this.setSvg(name);
1946
- },
1947
- enumerable: false,
1948
- configurable: true
1949
- });
1950
- GanttIconComponent.prototype.ngOnInit = function () { };
1951
- GanttIconComponent.prototype.ngAfterViewInit = function () { };
1952
- GanttIconComponent.prototype.setSvg = function (name) {
1953
- var iconSvg = icons[name];
1954
- if (iconSvg) {
1955
- this.elementRef.nativeElement.innerHTML = iconSvg;
1956
- }
1957
- else {
1958
- this.elementRef.nativeElement.innerHTML = '';
1959
- }
1960
- };
1961
- return GanttIconComponent;
1962
- }());
1963
- 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 });
1964
- 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 });
1965
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttIconComponent, decorators: [{
1966
- type: i0.Component,
1967
- args: [{
1968
- selector: 'gantt-icon',
1969
- template: ''
1970
- }]
1971
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { isIcon: [{
1972
- type: i0.HostBinding,
1973
- args: ['class.gantt-icon']
1974
- }], iconName: [{
1975
- type: i0.Input
2138
+ args: ['class.gantt-calendar-overlay']
1976
2139
  }] } });
1977
2140
 
1978
- var IsGanttRangeItemPipe = /** @class */ (function () {
1979
- function IsGanttRangeItemPipe() {
1980
- }
1981
- IsGanttRangeItemPipe.prototype.transform = function (value) {
1982
- return value === exports.GanttItemType.range;
1983
- };
1984
- return IsGanttRangeItemPipe;
1985
- }());
1986
- IsGanttRangeItemPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttRangeItemPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1987
- IsGanttRangeItemPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1988
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttRangeItemPipe, decorators: [{
1989
- type: i0.Pipe,
1990
- args: [{
1991
- name: 'isGanttRangeItem'
1992
- }]
1993
- }] });
1994
- var IsGanttBarItemPipe = /** @class */ (function () {
1995
- function IsGanttBarItemPipe() {
1996
- }
1997
- IsGanttBarItemPipe.prototype.transform = function (value) {
1998
- return value === exports.GanttItemType.bar;
1999
- };
2000
- return IsGanttBarItemPipe;
2001
- }());
2002
- IsGanttBarItemPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttBarItemPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
2003
- IsGanttBarItemPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
2004
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttBarItemPipe, decorators: [{
2005
- type: i0.Pipe,
2006
- args: [{
2007
- name: 'isGanttBarItem'
2008
- }]
2009
- }] });
2010
- var IsGanttCustomItemPipe = /** @class */ (function () {
2011
- function IsGanttCustomItemPipe() {
2012
- }
2013
- IsGanttCustomItemPipe.prototype.transform = function (value) {
2014
- return value === exports.GanttItemType.custom;
2015
- };
2016
- return IsGanttCustomItemPipe;
2017
- }());
2018
- IsGanttCustomItemPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttCustomItemPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
2019
- IsGanttCustomItemPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
2020
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttCustomItemPipe, decorators: [{
2021
- type: i0.Pipe,
2022
- args: [{
2023
- name: 'isGanttCustomItem'
2024
- }]
2025
- }] });
2026
-
2027
- var GanttTableBodyComponent = /** @class */ (function () {
2028
- function GanttTableBodyComponent(gantt) {
2029
- this.gantt = gantt;
2030
- this.ganttTableClass = true;
2031
- this.ganttTableEmptyClass = false;
2141
+ var GanttDragBackdropComponent = /** @class */ (function () {
2142
+ function GanttDragBackdropComponent() {
2143
+ this.backdropClass = true;
2032
2144
  }
2033
- Object.defineProperty(GanttTableBodyComponent.prototype, "tempData", {
2034
- set: function (data) {
2035
- var firstData = data[0];
2036
- if (firstData && firstData.hasOwnProperty('items')) {
2037
- this.hasGroup = true;
2038
- }
2039
- this.ganttTableEmptyClass = (data === null || data === void 0 ? void 0 : data.length) ? false : true;
2040
- this.flatData = data;
2041
- },
2042
- enumerable: false,
2043
- configurable: true
2044
- });
2045
- Object.defineProperty(GanttTableBodyComponent.prototype, "columns", {
2046
- set: function (columns) {
2047
- columns.forEach(function (column) {
2048
- if (!column.columnWidth) {
2049
- column.columnWidth = coercion.coerceCssPixelValue(defaultColumnWidth);
2050
- }
2051
- });
2052
- this.columnList = columns;
2053
- },
2054
- enumerable: false,
2055
- configurable: true
2056
- });
2057
- GanttTableBodyComponent.prototype.ngOnInit = function () { };
2058
- GanttTableBodyComponent.prototype.expandGroup = function (group) {
2059
- this.gantt.expandGroup(group);
2060
- };
2061
- GanttTableBodyComponent.prototype.expandChildren = function (item) {
2062
- this.gantt.expandChildren(item);
2063
- };
2064
- GanttTableBodyComponent.prototype.trackBy = function (item, index) {
2065
- return item.id || index;
2066
- };
2067
- return GanttTableBodyComponent;
2145
+ GanttDragBackdropComponent.prototype.ngOnInit = function () { };
2146
+ return GanttDragBackdropComponent;
2068
2147
  }());
2069
- GanttTableBodyComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttTableBodyComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Component });
2070
- GanttTableBodyComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: { tempData: "tempData", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate" }, host: { properties: { "class.gantt-table-body": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass" } }, ngImport: i0__namespace, template: "<div class=\"gantt-table-body-container\">\n <ng-container *ngIf=\"!flatData?.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=\"flatData && flatData.length > 0\">\n <ng-container *ngFor=\"let data of flatData; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"data.class\" *ngIf=\"data.items\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"data.expanded\" (click)=\"expandGroup(data)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"data.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: data.origin, group: data.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ data.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <div\n *ngIf=\"!data.items\"\n class=\"gantt-table-item gantt-table-row\"\n [class.gantt-table-item-with-group]=\"hasGroup\"\n [class.gantt-table-item-first-level-group]=\"data.level === 0 && (data.type | isGanttRangeItem)\"\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]=\"data.level * 20\">\n <ng-container *ngIf=\"data.level < gantt.maxLevel - 1 && data.expandable\">\n <gantt-icon\n *ngIf=\"!data.loading\"\n class=\"expand-icon\"\n [iconName]=\"data.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren(data)\"\n ></gantt-icon>\n <gantt-icon *ngIf=\"data.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: data.origin, item: data.origin }\"\n ></ng-template>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n</div>\n", components: [{ type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }], directives: [{ type: i1__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "isGanttRangeItem": IsGanttRangeItemPipe } });
2071
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttTableBodyComponent, decorators: [{
2148
+ GanttDragBackdropComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragBackdropComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
2149
+ 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" });
2150
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragBackdropComponent, decorators: [{
2072
2151
  type: i0.Component,
2073
2152
  args: [{
2074
- selector: 'gantt-table-body',
2075
- templateUrl: './gantt-table-body.component.html'
2153
+ selector: 'gantt-drag-backdrop',
2154
+ templateUrl: "./drag-backdrop.component.html"
2076
2155
  }]
2077
- }], ctorParameters: function () {
2078
- return [{ type: undefined, decorators: [{
2079
- type: i0.Inject,
2080
- args: [GANTT_ABSTRACT_TOKEN]
2081
- }] }];
2082
- }, propDecorators: { tempData: [{
2083
- type: i0.Input
2084
- }], columns: [{
2085
- type: i0.Input
2086
- }], groupTemplate: [{
2087
- type: i0.Input
2088
- }], emptyTemplate: [{
2089
- type: i0.Input
2090
- }], ganttTableClass: [{
2091
- type: i0.HostBinding,
2092
- args: ['class.gantt-table-body']
2093
- }], ganttTableEmptyClass: [{
2156
+ }], ctorParameters: function () { return []; }, propDecorators: { backdropClass: [{
2094
2157
  type: i0.HostBinding,
2095
- args: ['class.gantt-table-empty']
2158
+ args: ['class.gantt-drag-backdrop']
2096
2159
  }] } });
2097
2160
 
2098
- var mainHeight = 5000;
2099
- var GanttCalendarGridComponent = /** @class */ (function () {
2100
- function GanttCalendarGridComponent(ganttUpper, ngZone, elementRef) {
2101
- this.ganttUpper = ganttUpper;
2102
- this.ngZone = ngZone;
2161
+ var NgxGanttRootComponent = /** @class */ (function () {
2162
+ function NgxGanttRootComponent(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
2103
2163
  this.elementRef = elementRef;
2164
+ this.ngZone = ngZone;
2165
+ this.dom = dom;
2166
+ this.dragContainer = dragContainer;
2167
+ this.ganttUpper = ganttUpper;
2168
+ this.printService = printService;
2169
+ this.ganttClass = true;
2104
2170
  this.unsubscribe$ = new rxjs.Subject();
2105
- this.headerHeight = headerHeight;
2106
- this.mainHeight = mainHeight;
2107
- this.todayBorderRadius = todayBorderRadius;
2108
- this.viewTypes = exports.GanttViewType;
2109
- this.className = "gantt-calendar gantt-calendar-grid";
2171
+ this.ganttUpper.dragContainer = dragContainer;
2110
2172
  }
2111
- Object.defineProperty(GanttCalendarGridComponent.prototype, "view", {
2173
+ Object.defineProperty(NgxGanttRootComponent.prototype, "view", {
2112
2174
  get: function () {
2113
2175
  return this.ganttUpper.view;
2114
2176
  },
2115
2177
  enumerable: false,
2116
2178
  configurable: true
2117
2179
  });
2118
- GanttCalendarGridComponent.prototype.setTodayPoint = function () {
2119
- var x = this.view.getTodayXPoint();
2120
- var todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
2121
- var line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
2122
- if (isNumber(x)) {
2123
- if (line) {
2124
- line.style.left = x + "px";
2125
- line.style.top = "0px";
2126
- line.style.bottom = -mainHeight + "px";
2180
+ NgxGanttRootComponent.prototype.ngOnInit = function () {
2181
+ var _this = this;
2182
+ this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
2183
+ _this.dom.initialize(_this.elementRef);
2184
+ if (_this.printService) {
2185
+ _this.printService.register(_this.elementRef);
2127
2186
  }
2187
+ _this.setupScrollClass();
2188
+ _this.setupResize();
2189
+ _this.setupViewScroll();
2190
+ // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2191
+ _this.elementRef.nativeElement.style.opacity = '1';
2192
+ _this.ganttUpper.viewChange.pipe(operators.startWith(null)).subscribe(function () {
2193
+ _this.scrollToToday();
2194
+ });
2195
+ });
2196
+ };
2197
+ NgxGanttRootComponent.prototype.setupViewScroll = function () {
2198
+ var _this = this;
2199
+ if (this.ganttUpper.disabledLoadOnScroll) {
2200
+ return;
2128
2201
  }
2129
- else {
2130
- todayEle.style.display = 'none';
2131
- }
2202
+ this.dom
2203
+ .getViewerScroll()
2204
+ .pipe(operators.takeUntil(this.unsubscribe$))
2205
+ .subscribe(function (event) {
2206
+ if (event.direction === ScrollDirection.LEFT) {
2207
+ var dates_1 = _this.view.addStartDate();
2208
+ if (dates_1) {
2209
+ event.target.scrollLeft += _this.view.getDateRangeWidth(dates_1.start, dates_1.end);
2210
+ _this.ngZone.run(function () {
2211
+ _this.ganttUpper.loadOnScroll.emit({ start: dates_1.start.getUnixTime(), end: dates_1.end.getUnixTime() });
2212
+ });
2213
+ }
2214
+ }
2215
+ if (event.direction === ScrollDirection.RIGHT) {
2216
+ var dates_2 = _this.view.addEndDate();
2217
+ if (dates_2) {
2218
+ _this.ngZone.run(function () {
2219
+ _this.ganttUpper.loadOnScroll.emit({ start: dates_2.start.getUnixTime(), end: dates_2.end.getUnixTime() });
2220
+ });
2221
+ }
2222
+ }
2223
+ });
2132
2224
  };
2133
- GanttCalendarGridComponent.prototype.ngOnInit = function () {
2225
+ NgxGanttRootComponent.prototype.setupResize = function () {
2134
2226
  var _this = this;
2135
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
2136
- rxjs.merge(_this.ganttUpper.viewChange, _this.ganttUpper.view.start$)
2137
- .pipe(operators.takeUntil(_this.unsubscribe$))
2138
- .subscribe(function () {
2139
- _this.setTodayPoint();
2140
- });
2227
+ this.dom
2228
+ .getResize()
2229
+ .pipe(operators.takeUntil(this.unsubscribe$))
2230
+ .subscribe(function () {
2231
+ _this.setupScrollClass();
2141
2232
  });
2142
2233
  };
2143
- GanttCalendarGridComponent.prototype.ngAfterViewInit = function () { };
2144
- GanttCalendarGridComponent.prototype.ngOnChanges = function (changes) { };
2145
- GanttCalendarGridComponent.prototype.trackBy = function (point, index) {
2146
- return point.text || index;
2234
+ NgxGanttRootComponent.prototype.setupScrollClass = function () {
2235
+ var mainContainer = this.dom.mainContainer;
2236
+ var height = mainContainer.offsetHeight;
2237
+ var scrollHeight = mainContainer.scrollHeight;
2238
+ if (scrollHeight > height) {
2239
+ this.elementRef.nativeElement.className = 'gantt gantt-scroll';
2240
+ }
2241
+ else {
2242
+ this.elementRef.nativeElement.className = 'gantt';
2243
+ }
2147
2244
  };
2148
- GanttCalendarGridComponent.prototype.ngOnDestroy = function () {
2149
- this.unsubscribe$.next();
2150
- this.unsubscribe$.complete();
2245
+ NgxGanttRootComponent.prototype.scrollToToday = function () {
2246
+ var x = this.view.getTodayXPoint();
2247
+ this.dom.scrollMainContainer(x);
2151
2248
  };
2152
- return GanttCalendarGridComponent;
2249
+ return NgxGanttRootComponent;
2153
2250
  }());
2154
- GanttCalendarGridComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttCalendarGridComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0__namespace.NgZone }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
2155
- GanttCalendarGridComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid", host: { properties: { "class": "this.className" } }, usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-grid-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight - 1\">\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]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n </g>\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 </g>\n</svg>\n", directives: [{ type: i1__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
2156
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttCalendarGridComponent, decorators: [{
2251
+ 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 });
2252
+ 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"] }] });
2253
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttRootComponent, decorators: [{
2157
2254
  type: i0.Component,
2158
2255
  args: [{
2159
- selector: 'gantt-calendar-grid',
2160
- templateUrl: './calendar-grid.component.html'
2256
+ selector: 'ngx-gantt-root',
2257
+ templateUrl: './root.component.html',
2258
+ providers: [GanttDomService, GanttDragContainer]
2161
2259
  }]
2162
2260
  }], ctorParameters: function () {
2163
- return [{ type: GanttUpper, decorators: [{
2261
+ return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
2164
2262
  type: i0.Inject,
2165
2263
  args: [GANTT_UPPER_TOKEN]
2166
- }] }, { type: i0__namespace.NgZone }, { type: i0__namespace.ElementRef }];
2167
- }, propDecorators: { className: [{
2264
+ }] }, { type: GanttPrintService, decorators: [{
2265
+ type: i0.Optional
2266
+ }] }];
2267
+ }, propDecorators: { sideWidth: [{
2268
+ type: i0.Input
2269
+ }], ganttClass: [{
2168
2270
  type: i0.HostBinding,
2169
- args: ['class']
2170
- }] } });
2171
-
2172
- var LinkColors;
2173
- (function (LinkColors) {
2174
- LinkColors["default"] = "#cacaca";
2175
- LinkColors["blocked"] = "#FF7575";
2176
- LinkColors["active"] = "#348FE4";
2177
- })(LinkColors || (LinkColors = {}));
2271
+ args: ['class.gantt']
2272
+ }], sideTemplate: [{
2273
+ type: i0.ContentChild,
2274
+ args: ['sideTemplate', { static: true }]
2275
+ }], mainTemplate: [{
2276
+ type: i0.ContentChild,
2277
+ args: ['mainTemplate', { static: true }]
2278
+ }] } });
2279
+
2178
2280
  var GanttLinksComponent = /** @class */ (function () {
2179
2281
  function GanttLinksComponent(ganttUpper, cdr, elementRef, ganttDragContainer) {
2180
2282
  this.ganttUpper = ganttUpper;
2181
2283
  this.cdr = cdr;
2182
2284
  this.elementRef = elementRef;
2183
2285
  this.ganttDragContainer = ganttDragContainer;
2184
- this.flatData = [];
2286
+ this.groups = [];
2287
+ this.items = [];
2185
2288
  this.lineClick = new i0.EventEmitter();
2186
2289
  this.links = [];
2187
2290
  this.linkItems = [];
@@ -2192,8 +2295,8 @@
2192
2295
  }
2193
2296
  GanttLinksComponent.prototype.ngOnInit = function () {
2194
2297
  var _this = this;
2195
- this.firstChange = false;
2196
2298
  this.buildLinks();
2299
+ this.firstChange = false;
2197
2300
  this.ganttDragContainer.dragStarted.pipe(operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2198
2301
  _this.elementRef.nativeElement.style.visibility = 'hidden';
2199
2302
  });
@@ -2215,28 +2318,80 @@
2215
2318
  var lineHeight = this.ganttUpper.styles.lineHeight;
2216
2319
  var barHeight = this.ganttUpper.styles.barHeight;
2217
2320
  this.linkItems = [];
2218
- this.flatData.forEach(function (item, itemIndex) {
2219
- if (!item.hasOwnProperty('items')) {
2220
- var ganttItem = item;
2221
- if (ganttItem.refs) {
2222
- var y = itemIndex * lineHeight + ganttItem.refs.y + barHeight / 2;
2223
- _this.linkItems.push(Object.assign(Object.assign({}, ganttItem), { before: {
2224
- x: ganttItem.refs.x,
2225
- y: y
2226
- }, after: {
2227
- x: ganttItem.refs.x + ganttItem.refs.width,
2228
- y: y
2229
- } }));
2321
+ if (this.groups.length > 0) {
2322
+ var itemNum_1 = 0;
2323
+ var groupNum_1 = 0;
2324
+ this.groups.forEach(function (group) {
2325
+ groupNum_1++;
2326
+ if (group.expanded) {
2327
+ var items = recursiveItems(group.items);
2328
+ items.forEach(function (item, itemIndex) {
2329
+ var y = (groupNum_1 + itemNum_1 + itemIndex) * lineHeight + item.refs.y + barHeight / 2;
2330
+ _this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
2331
+ x: item.refs.x,
2332
+ y: y
2333
+ }, after: {
2334
+ x: item.refs.x + item.refs.width,
2335
+ y: y
2336
+ } }));
2337
+ });
2338
+ itemNum_1 += items.length;
2230
2339
  }
2231
- }
2232
- });
2340
+ });
2341
+ }
2342
+ else {
2343
+ var items = recursiveItems(this.items);
2344
+ items.forEach(function (item, itemIndex) {
2345
+ var y = itemIndex * lineHeight + item.refs.y + barHeight / 2;
2346
+ _this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
2347
+ x: item.refs.x,
2348
+ y: y
2349
+ }, after: {
2350
+ x: item.refs.x + item.refs.width,
2351
+ y: y
2352
+ } }));
2353
+ });
2354
+ }
2233
2355
  };
2234
- GanttLinksComponent.prototype.generatePath = function (source, target) {
2356
+ GanttLinksComponent.prototype.generatePath = function (source, target, type) {
2235
2357
  if (source.before && source.after && target.before && target.after) {
2236
2358
  var x1 = source.after.x;
2237
2359
  var y1 = source.after.y;
2238
2360
  var x4 = target.before.x;
2239
2361
  var y4 = target.before.y;
2362
+ var isMirror = void 0;
2363
+ var control = Math.abs(y4 - y1) / 2;
2364
+ switch (type) {
2365
+ case GanttLinkType.ss:
2366
+ x1 = source.before.x;
2367
+ y1 = source.before.y;
2368
+ x4 = target.before.x;
2369
+ y4 = target.before.y;
2370
+ isMirror = y4 > y1 ? 0 : 1;
2371
+ if (x4 > x1) {
2372
+ return "M " + x1 + " " + y1 + "\n A " + control + " " + control + " 0 1 " + isMirror + " " + x1 + " " + y4 + "\n L " + x1 + " " + y4 + " " + x4 + " " + y4;
2373
+ }
2374
+ else {
2375
+ return "M " + x1 + " " + y1 + "\n L " + x1 + " " + y1 + " " + x4 + " " + y1 + "\n A " + control + " " + control + " 0 1 " + isMirror + " " + x4 + " " + y4;
2376
+ }
2377
+ case GanttLinkType.ff:
2378
+ x1 = source.after.x;
2379
+ y1 = source.after.y;
2380
+ x4 = target.after.x;
2381
+ y4 = target.after.y;
2382
+ isMirror = y4 > y1 ? 1 : 0;
2383
+ if (x4 > x1) {
2384
+ return "M " + x1 + " " + y1 + "\n L " + x1 + " " + y1 + " " + x4 + " " + y1 + "\n A " + control + " " + control + " 0 1 " + isMirror + " " + x4 + " " + y4;
2385
+ }
2386
+ else {
2387
+ return "M " + x1 + " " + y1 + "\n A " + control + " " + control + " 0 1 " + isMirror + " " + x1 + " " + y4 + "\n L " + x1 + " " + y4 + " " + x4 + " " + y4;
2388
+ }
2389
+ case GanttLinkType.sf:
2390
+ x1 = target.after.x;
2391
+ y1 = target.after.y;
2392
+ x4 = source.before.x;
2393
+ y4 = source.before.y;
2394
+ }
2240
2395
  var dx = Math.abs(x4 - x1) * this.bezierWeight;
2241
2396
  var x2 = x1 - dx;
2242
2397
  var x3 = x4 + dx;
@@ -2273,13 +2428,14 @@
2273
2428
  this.links = [];
2274
2429
  this.linkItems.forEach(function (source) {
2275
2430
  if (source.origin.start || source.origin.end) {
2276
- source.links.forEach(function (linkId) {
2277
- var target = _this.linkItems.find(function (item) { return item.id === linkId; });
2431
+ source.links.forEach(function (link) {
2432
+ var target = _this.linkItems.find(function (item) { return item.id === link.link; });
2278
2433
  if (target && (target.origin.start || target.origin.end)) {
2279
2434
  _this.links.push({
2280
- path: _this.generatePath(source, target),
2435
+ path: _this.generatePath(source, target, link.type),
2281
2436
  source: source.origin,
2282
2437
  target: target.origin,
2438
+ type: link.type,
2283
2439
  color: source.end.getTime() > target.start.getTime() ? LinkColors.blocked : LinkColors.default
2284
2440
  });
2285
2441
  }
@@ -2314,7 +2470,7 @@
2314
2470
  return GanttLinksComponent;
2315
2471
  }());
2316
2472
  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 });
2317
- GanttLinksComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: { flatData: "flatData" }, 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: i1__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
2473
+ 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\n [attr.d]=\"link.path\"\n fill=\"transparent\"\n stroke-width=\"2\"\n [attr.stroke]=\"link.color\"\n pointer-events=\"none\"\n [style]=\"'marker-end: url(#triangle' + i + ')'\"\n ></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 <!-- <defs>\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"auto\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n </defs> -->\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"] }] });
2318
2474
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttLinksComponent, decorators: [{
2319
2475
  type: i0.Component,
2320
2476
  args: [{
@@ -2326,7 +2482,9 @@
2326
2482
  type: i0.Inject,
2327
2483
  args: [GANTT_UPPER_TOKEN]
2328
2484
  }] }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.ElementRef }, { type: GanttDragContainer }];
2329
- }, propDecorators: { flatData: [{
2485
+ }, propDecorators: { groups: [{
2486
+ type: i0.Input
2487
+ }], items: [{
2330
2488
  type: i0.Input
2331
2489
  }], lineClick: [{
2332
2490
  type: i0.Output
@@ -2355,11 +2513,10 @@
2355
2513
  }
2356
2514
  };
2357
2515
  GanttItemUpper.prototype.setPositions = function () {
2358
- var _a, _b, _c;
2359
2516
  var itemElement = this.elementRef.nativeElement;
2360
- itemElement.style.left = ((_a = this.item.refs) === null || _a === void 0 ? void 0 : _a.x) + 'px';
2361
- itemElement.style.top = ((_b = this.item.refs) === null || _b === void 0 ? void 0 : _b.y) + 'px';
2362
- itemElement.style.width = ((_c = this.item.refs) === null || _c === void 0 ? void 0 : _c.width) + 'px';
2517
+ itemElement.style.left = this.item.refs.x + 'px';
2518
+ itemElement.style.top = this.item.refs.y + 'px';
2519
+ itemElement.style.width = this.item.refs.width + 'px';
2363
2520
  if (this.item.type === exports.GanttItemType.bar) {
2364
2521
  itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2365
2522
  }
@@ -2409,7 +2566,7 @@
2409
2566
  return NgxGanttRangeComponent;
2410
2567
  }(GanttItemUpper));
2411
2568
  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 });
2412
- 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: i1__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2569
+ 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"] }] });
2413
2570
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttRangeComponent, decorators: [{
2414
2571
  type: i0.Component,
2415
2572
  args: [{
@@ -2497,6 +2654,8 @@
2497
2654
  var start = _this.ganttUpper.view.getDateByXPoint(x);
2498
2655
  var end = start.addDays(days);
2499
2656
  _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), end);
2657
+ _this.item.updateDate(start, end);
2658
+ _this.dragContainer.dragMoved.emit({ item: _this.item.origin });
2500
2659
  });
2501
2660
  dragRef.ended.subscribe(function (event) {
2502
2661
  var days = dateFns.differenceInCalendarDays(_this.item.end.value, _this.item.start.value);
@@ -2532,6 +2691,7 @@
2532
2691
  _this.barElement.style.width = width + 'px';
2533
2692
  _this.barElement.style.left = x + 'px';
2534
2693
  _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), _this.ganttUpper.view.getDateByXPoint(x + width));
2694
+ _this.item.updateDate(_this.ganttUpper.view.getDateByXPoint(x), _this.item.end);
2535
2695
  }
2536
2696
  }
2537
2697
  else {
@@ -2540,7 +2700,9 @@
2540
2700
  _this.barElement.style.width = width + 'px';
2541
2701
  _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x), _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + width));
2542
2702
  }
2703
+ _this.item.updateDate(_this.item.start, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + width));
2543
2704
  }
2705
+ _this.dragContainer.dragMoved.emit({ item: _this.item.origin });
2544
2706
  event.source.reset();
2545
2707
  });
2546
2708
  dragRef.ended.subscribe(function (event) {
@@ -2690,11 +2852,11 @@
2690
2852
  };
2691
2853
  return GanttBarDrag;
2692
2854
  }());
2693
- GanttBarDrag.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttBarDrag, deps: [{ token: i1__namespace$1.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2855
+ 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 });
2694
2856
  GanttBarDrag.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttBarDrag });
2695
2857
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttBarDrag, decorators: [{
2696
2858
  type: i0.Injectable
2697
- }], ctorParameters: function () { return [{ type: i1__namespace$1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }]; } });
2859
+ }], ctorParameters: function () { return [{ type: i1__namespace.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }]; } });
2698
2860
 
2699
2861
  function linearGradient(sideOrCorner, color, stop) {
2700
2862
  return "linear-gradient(" + sideOrCorner + "," + color + " 0%," + stop + " 40%)";
@@ -2765,7 +2927,7 @@
2765
2927
  return NgxGanttBarComponent;
2766
2928
  }(GanttItemUpper));
2767
2929
  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 });
2768
- 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: i1__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2930
+ 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"] }] });
2769
2931
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttBarComponent, decorators: [{
2770
2932
  type: i0.Component,
2771
2933
  args: [{
@@ -2796,13 +2958,13 @@
2796
2958
  this.ganttMainClass = true;
2797
2959
  }
2798
2960
  GanttMainComponent.prototype.ngOnInit = function () { };
2799
- GanttMainComponent.prototype.trackBy = function (item, index) {
2961
+ GanttMainComponent.prototype.trackBy = function (index, item) {
2800
2962
  return item.id || index;
2801
2963
  };
2802
2964
  return GanttMainComponent;
2803
2965
  }());
2804
2966
  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 });
2805
- GanttMainComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttMainComponent, selector: "gantt-main", inputs: { tempData: "tempData", flatData: "flatData", 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 [flatData]=\"flatData\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n\n<div class=\"gantt-main-groups\" *ngIf=\"tempData && tempData.length > 0\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let data of tempData; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"data.class\" *ngIf=\"data.items\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: data }\"></ng-template>\n </div>\n <div class=\"gantt-item\" [style.height.px]=\"ganttUpper.styles.lineHeight\" *ngIf=\"!data.items\">\n <ng-container *ngIf=\"data.type | isGanttCustomItem\">\n <ng-template [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{ item: data.origin, refs: data.refs }\"></ng-template>\n </ng-container>\n <gantt-range *ngIf=\"data.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"data\"></gantt-range>\n <gantt-bar *ngIf=\"data.type | isGanttBarItem\" [item]=\"data\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n </div>\n </ng-container>\n</div>\n", components: [{ type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: ["flatData"], outputs: ["lineClick"] }, { type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range" }, { type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: ["barClick"] }], directives: [{ type: i1__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "isGanttCustomItem": IsGanttCustomItemPipe, "isGanttRangeItem": IsGanttRangeItemPipe, "isGanttBarItem": IsGanttBarItemPipe } });
2967
+ 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 } });
2806
2968
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttMainComponent, decorators: [{
2807
2969
  type: i0.Component,
2808
2970
  args: [{
@@ -2814,9 +2976,9 @@
2814
2976
  type: i0.Inject,
2815
2977
  args: [GANTT_UPPER_TOKEN]
2816
2978
  }] }];
2817
- }, propDecorators: { tempData: [{
2979
+ }, propDecorators: { groups: [{
2818
2980
  type: i0.Input
2819
- }], flatData: [{
2981
+ }], items: [{
2820
2982
  type: i0.Input
2821
2983
  }], groupHeaderTemplate: [{
2822
2984
  type: i0.Input
@@ -2835,62 +2997,22 @@
2835
2997
  args: ['class.gantt-main-container']
2836
2998
  }] } });
2837
2999
 
2838
- var GanttDragBackdropComponent = /** @class */ (function () {
2839
- function GanttDragBackdropComponent() {
2840
- this.backdropClass = true;
2841
- }
2842
- GanttDragBackdropComponent.prototype.ngOnInit = function () { };
2843
- return GanttDragBackdropComponent;
2844
- }());
2845
- GanttDragBackdropComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragBackdropComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
2846
- 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" });
2847
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragBackdropComponent, decorators: [{
2848
- type: i0.Component,
2849
- args: [{
2850
- selector: 'gantt-drag-backdrop',
2851
- templateUrl: "./drag-backdrop.component.html"
2852
- }]
2853
- }], ctorParameters: function () { return []; }, propDecorators: { backdropClass: [{
2854
- type: i0.HostBinding,
2855
- args: ['class.gantt-drag-backdrop']
2856
- }] } });
2857
-
2858
3000
  var NgxGanttComponent = /** @class */ (function (_super) {
2859
3001
  __extends(NgxGanttComponent, _super);
2860
- function NgxGanttComponent(elementRef, cdr, ngZone, dom, dragContainer, printService) {
2861
- var _this = _super.call(this, elementRef, cdr, ngZone) || this;
2862
- _this.dom = dom;
2863
- _this.dragContainer = dragContainer;
2864
- _this.printService = printService;
3002
+ function NgxGanttComponent(elementRef, cdr, ngZone, config) {
3003
+ var _this = _super.call(this, elementRef, cdr, ngZone, config) || this;
2865
3004
  _this.maxLevel = 2;
2866
3005
  _this.linkDragStarted = new i0.EventEmitter();
2867
3006
  _this.linkDragEnded = new i0.EventEmitter();
2868
3007
  _this.lineClick = new i0.EventEmitter();
2869
- _this.flatData = [];
2870
- _this.tempData = [];
2871
3008
  _this.ngUnsubscribe$ = new rxjs.Subject();
2872
- _this.dragContainer = dragContainer;
2873
- _this.computeAllRefs = false;
3009
+ _this.sideTableWidth = sideWidth;
2874
3010
  return _this;
2875
3011
  }
2876
3012
  NgxGanttComponent.prototype.ngOnInit = function () {
2877
3013
  var _this = this;
2878
3014
  _super.prototype.onInit.call(this);
2879
- this.buildVirtualFlatData();
2880
3015
  this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
2881
- _this.dom.initialize(_this.elementRef);
2882
- if (_this.printService) {
2883
- _this.printService.register(_this.elementRef);
2884
- }
2885
- _this.setupViewScroll();
2886
- // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2887
- _this.elementRef.nativeElement.style.opacity = '1';
2888
- _this.viewChange.pipe(operators.startWith(null)).subscribe(function () {
2889
- _this.scrollToToday();
2890
- });
2891
- _this.dragContainer.dragEnded.subscribe(function (event) {
2892
- _this.computeTempDataRefs();
2893
- });
2894
3016
  _this.dragContainer.linkDragStarted.pipe(operators.takeUntil(_this.ngUnsubscribe$)).subscribe(function (event) {
2895
3017
  _this.linkDragStarted.emit(event);
2896
3018
  });
@@ -2898,9 +3020,6 @@
2898
3020
  _this.linkDragEnded.emit(event);
2899
3021
  });
2900
3022
  });
2901
- this.view.start$.pipe(operators.skip(1), operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2902
- _this.computeTempDataRefs();
2903
- });
2904
3023
  };
2905
3024
  NgxGanttComponent.prototype.ngAfterViewInit = function () {
2906
3025
  var _this = this;
@@ -2912,40 +3031,9 @@
2912
3031
  });
2913
3032
  _this.cdr.detectChanges();
2914
3033
  });
2915
- this.virtualScroll.renderedRangeStream.subscribe(function (range) {
2916
- var linksElement = _this.elementRef.nativeElement.querySelector('.gantt-links-overlay');
2917
- linksElement.style.top = -(_this.styles.lineHeight * range.start) + "px";
2918
- _this.rangeStart = range.start;
2919
- _this.rangeEnd = range.end;
2920
- _this.tempData = _this.flatData.slice(range.start, range.end);
2921
- _this.computeTempDataRefs();
2922
- });
2923
3034
  };
2924
3035
  NgxGanttComponent.prototype.ngOnChanges = function (changes) {
2925
3036
  _super.prototype.onChanges.call(this, changes);
2926
- if (!this.firstChange) {
2927
- if (changes.viewType && changes.viewType.currentValue) {
2928
- this.tempData = this.flatData.slice(this.rangeStart, this.rangeEnd);
2929
- this.computeTempDataRefs();
2930
- }
2931
- if (changes.originItems || changes.originGroups) {
2932
- this.buildVirtualFlatData();
2933
- this.tempData = this.flatData.slice(this.rangeStart, this.rangeEnd);
2934
- this.computeTempDataRefs();
2935
- }
2936
- }
2937
- };
2938
- NgxGanttComponent.prototype.expandGroup = function (group) {
2939
- group.setExpand(!group.expanded);
2940
- this.afterExpand();
2941
- this.expandChange.emit();
2942
- this.cdr.detectChanges();
2943
- };
2944
- NgxGanttComponent.prototype.expandAll = function () {
2945
- this.expandGroups(true);
2946
- };
2947
- NgxGanttComponent.prototype.collapseAll = function () {
2948
- this.expandGroups(false);
2949
3037
  };
2950
3038
  NgxGanttComponent.prototype.expandChildren = function (item) {
2951
3039
  var _this = this;
@@ -2956,7 +3044,6 @@
2956
3044
  this.childrenResolve(item.origin)
2957
3045
  .pipe(operators.take(1), operators.finalize(function () {
2958
3046
  item.loading = false;
2959
- _this.afterExpand();
2960
3047
  _this.expandChange.emit();
2961
3048
  _this.cdr.detectChanges();
2962
3049
  }))
@@ -2967,110 +3054,21 @@
2967
3054
  }
2968
3055
  else {
2969
3056
  this.computeItemsRefs.apply(this, __spreadArray([], __read(item.children)));
2970
- this.afterExpand();
2971
3057
  this.expandChange.emit();
2972
3058
  }
2973
3059
  }
2974
3060
  else {
2975
3061
  item.setExpand(false);
2976
- this.afterExpand();
2977
3062
  this.expandChange.emit();
2978
3063
  }
2979
3064
  };
2980
- NgxGanttComponent.prototype.buildVirtualFlatData = function () {
2981
- var virtualData = [];
2982
- if (this.groups.length) {
2983
- this.groups.forEach(function (group) {
2984
- virtualData.push(group);
2985
- if (group.expanded) {
2986
- var items = recursiveItems(group.items, 0);
2987
- virtualData.push.apply(virtualData, __spreadArray([], __read(items)));
2988
- }
2989
- });
2990
- }
2991
- if (this.items.length) {
2992
- virtualData.push.apply(virtualData, __spreadArray([], __read(recursiveItems(this.items, 0))));
2993
- }
2994
- this.flatData = __spreadArray([], __read(virtualData));
2995
- this.flatDataMap = keyBy(this.flatData, 'id');
2996
- };
2997
- NgxGanttComponent.prototype.afterExpand = function () {
2998
- this.buildVirtualFlatData();
2999
- this.tempData = this.flatData.slice(this.rangeStart, this.rangeEnd);
3000
- };
3001
- NgxGanttComponent.prototype.trackBy = function (item, index) {
3002
- return item.id || index;
3003
- };
3004
- NgxGanttComponent.prototype.scrollToToday = function () {
3005
- var x = this.view.getTodayXPoint();
3006
- this.dom.scrollMainContainer(x);
3007
- };
3008
- NgxGanttComponent.prototype.setupViewScroll = function () {
3009
- var _this = this;
3010
- if (this.disabledLoadOnScroll) {
3011
- return;
3012
- }
3013
- this.dom
3014
- .getViewerScroll()
3015
- .pipe(operators.takeUntil(this.unsubscribe$))
3016
- .subscribe(function (event) {
3017
- if (event.direction === ScrollDirection.LEFT) {
3018
- var dates_1 = _this.view.addStartDate();
3019
- if (dates_1) {
3020
- event.target.scrollLeft += _this.view.getDateRangeWidth(dates_1.start, dates_1.end);
3021
- _this.ngZone.run(function () {
3022
- _this.loadOnScroll.emit({ start: dates_1.start.getUnixTime(), end: dates_1.end.getUnixTime() });
3023
- });
3024
- }
3025
- }
3026
- if (event.direction === ScrollDirection.RIGHT) {
3027
- var dates_2 = _this.view.addEndDate();
3028
- if (dates_2) {
3029
- _this.ngZone.run(function () {
3030
- _this.loadOnScroll.emit({ start: dates_2.start.getUnixTime(), end: dates_2.end.getUnixTime() });
3031
- });
3032
- }
3033
- }
3034
- _this.cdr.detectChanges();
3035
- });
3036
- };
3037
- NgxGanttComponent.prototype.expandGroups = function (expanded) {
3038
- this.groups.forEach(function (group) {
3039
- group.setExpand(expanded);
3040
- });
3041
- this.afterExpand();
3042
- this.expandChange.next();
3043
- this.cdr.detectChanges();
3044
- };
3045
- NgxGanttComponent.prototype.computeTempDataRefs = function () {
3046
- var _this = this;
3047
- var tempItemData = [];
3048
- this.tempData.forEach(function (data) {
3049
- if (!data.hasOwnProperty('items')) {
3050
- var item = data;
3051
- if (item.links) {
3052
- item.links.forEach(function (link) {
3053
- if (_this.flatDataMap[link]) {
3054
- tempItemData.push(_this.flatDataMap[link]);
3055
- }
3056
- });
3057
- }
3058
- tempItemData.push(data);
3059
- }
3060
- });
3061
- this.computeItemsRefs.apply(this, __spreadArray([], __read(uniqBy(tempItemData, 'id'))));
3062
- this.flatData = __spreadArray([], __read(this.flatData));
3063
- this.tempData = __spreadArray([], __read(this.tempData));
3064
- };
3065
3065
  NgxGanttComponent.prototype.ngOnDestroy = function () {
3066
3066
  _super.prototype.onDestroy.call(this);
3067
3067
  };
3068
3068
  return NgxGanttComponent;
3069
3069
  }(GanttUpper));
3070
- 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 }, { token: GanttDomService }, { token: GanttDragContainer }, { token: GanttPrintService, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Component });
3070
+ 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 }, { token: GANTT_GLOBAL_CONFIG }], target: i0__namespace.ɵɵFactoryTarget.Component });
3071
3071
  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: [
3072
- GanttDomService,
3073
- GanttDragContainer,
3074
3072
  {
3075
3073
  provide: GANTT_UPPER_TOKEN,
3076
3074
  useExisting: NgxGanttComponent
@@ -3079,7 +3077,7 @@
3079
3077
  provide: GANTT_ABSTRACT_TOKEN,
3080
3078
  useExisting: i0.forwardRef(function () { return NgxGanttComponent; })
3081
3079
  }
3082
- ], 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 }], viewQueries: [{ propertyName: "virtualScroll", first: true, predicate: i6.CdkVirtualScrollViewport, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header></gantt-calendar-header>\n </div>\n</div>\n\n<cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n>\n <ng-container *cdkVirtualFor=\"let item of flatData; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth\">\n <div class=\"gantt-side-container\">\n <gantt-table-body\n [tempData]=\"tempData\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n ></gantt-table-body>\n </div>\n </div>\n <div class=\"gantt-container\">\n <gantt-calendar-grid></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n [tempData]=\"tempData\"\n [flatData]=\"flatData\"\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 </div>\n </div>\n</cdk-virtual-scroll-viewport>\n\n<gantt-drag-backdrop [style.left.px]=\"tableHeader.tableWidth\"></gantt-drag-backdrop>\n", components: [{ type: GanttTableHeaderComponent, selector: "gantt-table-header", inputs: ["columns"] }, { type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header" }, { type: i6__namespace.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: ["tempData", "columns", "groupTemplate", "emptyTemplate"] }, { type: GanttCalendarGridComponent, selector: "gantt-calendar-grid" }, { type: GanttMainComponent, selector: "gantt-main", inputs: ["tempData", "flatData", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }, { type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }], directives: [{ type: i6__namespace.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { type: i6__namespace.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
3080
+ ], 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\n [groups]=\"groups\"\n [items]=\"items\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n ></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", "rowBeforeTemplate", "rowAfterTemplate"] }, { type: GanttMainComponent, selector: "gantt-main", inputs: ["groups", "items", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
3083
3081
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttComponent, decorators: [{
3084
3082
  type: i0.Component,
3085
3083
  args: [{
@@ -3087,8 +3085,6 @@
3087
3085
  templateUrl: './gantt.component.html',
3088
3086
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
3089
3087
  providers: [
3090
- GanttDomService,
3091
- GanttDragContainer,
3092
3088
  {
3093
3089
  provide: GANTT_UPPER_TOKEN,
3094
3090
  useExisting: NgxGanttComponent
@@ -3100,8 +3096,9 @@
3100
3096
  ]
3101
3097
  }]
3102
3098
  }], ctorParameters: function () {
3103
- return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttPrintService, decorators: [{
3104
- type: i0.Optional
3099
+ return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }, { type: undefined, decorators: [{
3100
+ type: i0.Inject,
3101
+ args: [GANTT_GLOBAL_CONFIG]
3105
3102
  }] }];
3106
3103
  }, propDecorators: { maxLevel: [{
3107
3104
  type: i0.Input
@@ -3126,128 +3123,6 @@
3126
3123
  }], tableEmptyTemplate: [{
3127
3124
  type: i0.ContentChild,
3128
3125
  args: ['tableEmpty', { static: true }]
3129
- }], virtualScroll: [{
3130
- type: i0.ViewChild,
3131
- args: [i6.CdkVirtualScrollViewport]
3132
- }] } });
3133
-
3134
- var NgxGanttRootComponent = /** @class */ (function () {
3135
- function NgxGanttRootComponent(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
3136
- this.elementRef = elementRef;
3137
- this.ngZone = ngZone;
3138
- this.dom = dom;
3139
- this.dragContainer = dragContainer;
3140
- this.ganttUpper = ganttUpper;
3141
- this.printService = printService;
3142
- this.ganttClass = true;
3143
- this.unsubscribe$ = new rxjs.Subject();
3144
- this.ganttUpper.dragContainer = dragContainer;
3145
- }
3146
- Object.defineProperty(NgxGanttRootComponent.prototype, "view", {
3147
- get: function () {
3148
- return this.ganttUpper.view;
3149
- },
3150
- enumerable: false,
3151
- configurable: true
3152
- });
3153
- NgxGanttRootComponent.prototype.ngOnInit = function () {
3154
- var _this = this;
3155
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
3156
- _this.dom.initialize(_this.elementRef);
3157
- if (_this.printService) {
3158
- _this.printService.register(_this.elementRef);
3159
- }
3160
- _this.setupScrollClass();
3161
- _this.setupResize();
3162
- _this.setupViewScroll();
3163
- // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
3164
- _this.elementRef.nativeElement.style.opacity = '1';
3165
- _this.ganttUpper.viewChange.pipe(operators.startWith(null)).subscribe(function () {
3166
- _this.scrollToToday();
3167
- });
3168
- });
3169
- };
3170
- NgxGanttRootComponent.prototype.setupViewScroll = function () {
3171
- var _this = this;
3172
- if (this.ganttUpper.disabledLoadOnScroll) {
3173
- return;
3174
- }
3175
- this.dom
3176
- .getViewerScroll()
3177
- .pipe(operators.takeUntil(this.unsubscribe$))
3178
- .subscribe(function (event) {
3179
- if (event.direction === ScrollDirection.LEFT) {
3180
- var dates_1 = _this.view.addStartDate();
3181
- if (dates_1) {
3182
- event.target.scrollLeft += _this.view.getDateRangeWidth(dates_1.start, dates_1.end);
3183
- _this.ngZone.run(function () {
3184
- _this.ganttUpper.loadOnScroll.emit({ start: dates_1.start.getUnixTime(), end: dates_1.end.getUnixTime() });
3185
- });
3186
- }
3187
- }
3188
- if (event.direction === ScrollDirection.RIGHT) {
3189
- var dates_2 = _this.view.addEndDate();
3190
- if (dates_2) {
3191
- _this.ngZone.run(function () {
3192
- _this.ganttUpper.loadOnScroll.emit({ start: dates_2.start.getUnixTime(), end: dates_2.end.getUnixTime() });
3193
- });
3194
- }
3195
- }
3196
- });
3197
- };
3198
- NgxGanttRootComponent.prototype.setupResize = function () {
3199
- var _this = this;
3200
- this.dom
3201
- .getResize()
3202
- .pipe(operators.takeUntil(this.unsubscribe$))
3203
- .subscribe(function () {
3204
- _this.setupScrollClass();
3205
- });
3206
- };
3207
- NgxGanttRootComponent.prototype.setupScrollClass = function () {
3208
- var mainContainer = this.dom.mainContainer;
3209
- var height = mainContainer.offsetHeight;
3210
- var scrollHeight = mainContainer.scrollHeight;
3211
- if (scrollHeight > height) {
3212
- this.elementRef.nativeElement.className = 'gantt gantt-scroll';
3213
- }
3214
- else {
3215
- this.elementRef.nativeElement.className = 'gantt';
3216
- }
3217
- };
3218
- NgxGanttRootComponent.prototype.scrollToToday = function () {
3219
- var x = this.view.getTodayXPoint();
3220
- this.dom.scrollMainContainer(x);
3221
- };
3222
- return NgxGanttRootComponent;
3223
- }());
3224
- 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 });
3225
- 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-header></gantt-calendar-header>\n <gantt-calendar-grid></gantt-calendar-grid>\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: GanttCalendarHeaderComponent, selector: "gantt-calendar-header" }, { type: GanttCalendarGridComponent, selector: "gantt-calendar-grid" }, { type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }], directives: [{ type: i1__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
3226
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttRootComponent, decorators: [{
3227
- type: i0.Component,
3228
- args: [{
3229
- selector: 'ngx-gantt-root',
3230
- templateUrl: './root.component.html',
3231
- providers: [GanttDomService, GanttDragContainer]
3232
- }]
3233
- }], ctorParameters: function () {
3234
- return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
3235
- type: i0.Inject,
3236
- args: [GANTT_UPPER_TOKEN]
3237
- }] }, { type: GanttPrintService, decorators: [{
3238
- type: i0.Optional
3239
- }] }];
3240
- }, propDecorators: { sideWidth: [{
3241
- type: i0.Input
3242
- }], ganttClass: [{
3243
- type: i0.HostBinding,
3244
- args: ['class.gantt']
3245
- }], sideTemplate: [{
3246
- type: i0.ContentChild,
3247
- args: ['sideTemplate', { static: true }]
3248
- }], mainTemplate: [{
3249
- type: i0.ContentChild,
3250
- args: ['mainTemplate', { static: true }]
3251
3126
  }] } });
3252
3127
 
3253
3128
  var NgxGanttModule = /** @class */ (function () {
@@ -3259,11 +3134,9 @@
3259
3134
  NgxGanttModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, declarations: [NgxGanttComponent,
3260
3135
  NgxGanttTableComponent,
3261
3136
  NgxGanttTableColumnComponent,
3262
- GanttTableHeaderComponent,
3263
- GanttTableBodyComponent,
3137
+ GanttTableComponent,
3264
3138
  GanttMainComponent,
3265
- GanttCalendarHeaderComponent,
3266
- GanttCalendarGridComponent,
3139
+ GanttCalendarComponent,
3267
3140
  GanttLinksComponent,
3268
3141
  NgxGanttBarComponent,
3269
3142
  GanttIconComponent,
@@ -3272,17 +3145,22 @@
3272
3145
  NgxGanttRootComponent,
3273
3146
  IsGanttRangeItemPipe,
3274
3147
  IsGanttBarItemPipe,
3275
- IsGanttCustomItemPipe], imports: [i1.CommonModule, i1$1.DragDropModule, i6.ScrollingModule], exports: [NgxGanttComponent,
3148
+ IsGanttCustomItemPipe], imports: [i2.CommonModule, i1.DragDropModule], exports: [NgxGanttComponent,
3276
3149
  NgxGanttTableComponent,
3277
3150
  NgxGanttTableColumnComponent,
3278
3151
  NgxGanttRootComponent,
3279
3152
  NgxGanttBarComponent,
3280
3153
  NgxGanttRangeComponent] });
3281
- NgxGanttModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, providers: [i6.CdkVirtualScrollViewport], imports: [[i1.CommonModule, i1$1.DragDropModule, i6.ScrollingModule]] });
3154
+ NgxGanttModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, providers: [
3155
+ {
3156
+ provide: GANTT_GLOBAL_CONFIG,
3157
+ useValue: defaultConfig
3158
+ }
3159
+ ], imports: [[i2.CommonModule, i1.DragDropModule]] });
3282
3160
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, decorators: [{
3283
3161
  type: i0.NgModule,
3284
3162
  args: [{
3285
- imports: [i1.CommonModule, i1$1.DragDropModule, i6.ScrollingModule],
3163
+ imports: [i2.CommonModule, i1.DragDropModule],
3286
3164
  exports: [
3287
3165
  NgxGanttComponent,
3288
3166
  NgxGanttTableComponent,
@@ -3295,11 +3173,9 @@
3295
3173
  NgxGanttComponent,
3296
3174
  NgxGanttTableComponent,
3297
3175
  NgxGanttTableColumnComponent,
3298
- GanttTableHeaderComponent,
3299
- GanttTableBodyComponent,
3176
+ GanttTableComponent,
3300
3177
  GanttMainComponent,
3301
- GanttCalendarHeaderComponent,
3302
- GanttCalendarGridComponent,
3178
+ GanttCalendarComponent,
3303
3179
  GanttLinksComponent,
3304
3180
  NgxGanttBarComponent,
3305
3181
  GanttIconComponent,
@@ -3310,7 +3186,12 @@
3310
3186
  IsGanttBarItemPipe,
3311
3187
  IsGanttCustomItemPipe
3312
3188
  ],
3313
- providers: [i6.CdkVirtualScrollViewport]
3189
+ providers: [
3190
+ {
3191
+ provide: GANTT_GLOBAL_CONFIG,
3192
+ useValue: defaultConfig
3193
+ }
3194
+ ]
3314
3195
  }]
3315
3196
  }] });
3316
3197
 
@@ -3514,6 +3395,7 @@
3514
3395
  return dateFns.startOfYear;
3515
3396
  }
3516
3397
  });
3398
+ exports.GANTT_GLOBAL_CONFIG = GANTT_GLOBAL_CONFIG;
3517
3399
  exports.GANTT_UPPER_TOKEN = GANTT_UPPER_TOKEN;
3518
3400
  exports.GanttBarClickEvent = GanttBarClickEvent;
3519
3401
  exports.GanttDate = GanttDate;
@@ -3539,6 +3421,7 @@
3539
3421
  exports.NgxGanttRootComponent = NgxGanttRootComponent;
3540
3422
  exports.NgxGanttTableColumnComponent = NgxGanttTableColumnComponent;
3541
3423
  exports.NgxGanttTableComponent = NgxGanttTableComponent;
3424
+ exports.defaultConfig = defaultConfig;
3542
3425
  exports.primaryDatePointTop = primaryDatePointTop;
3543
3426
  exports.secondaryDatePointTop = secondaryDatePointTop;
3544
3427