@worktile/gantt 12.1.0-next.0 → 12.1.3

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 +821 -907
  2. package/bundles/worktile-gantt.umd.js.map +1 -1
  3. package/class/event.d.ts +4 -0
  4. package/class/item.d.ts +4 -5
  5. package/components/calendar/{grid/calendar-grid.component.d.ts → calendar.component.d.ts} +10 -8
  6. package/components/links/links.component.d.ts +3 -2
  7. package/components/main/gantt-main.component.d.ts +4 -4
  8. package/components/table/gantt-table.component.d.ts +42 -0
  9. package/esm2015/class/event.js +3 -1
  10. package/esm2015/class/item.js +1 -1
  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 +42 -19
  14. package/esm2015/components/main/gantt-main.component.js +5 -5
  15. package/esm2015/components/table/gantt-table.component.js +163 -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 +110 -35
  21. package/esm2015/gantt.component.js +34 -169
  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 +794 -874
  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 +23 -5
  39. package/gantt.component.d.ts +8 -27
  40. package/gantt.config.d.ts +23 -0
  41. package/gantt.module.d.ts +13 -16
  42. package/main.bundle.scss +206 -233
  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/collections'), 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/collections', '@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.collections, global.ng.cdk.coercion, global.ng.cdk.dragDrop, global.html2canvas));
5
+ }(this, (function (exports, i0, i2, operators, rxjs, dateFns, collections, 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
  /*! *****************************************************************************
@@ -391,6 +390,11 @@
391
390
  }
392
391
  return GanttBarClickEvent;
393
392
  }());
393
+ var GanttSelectedEvent = /** @class */ (function () {
394
+ function GanttSelectedEvent() {
395
+ }
396
+ return GanttSelectedEvent;
397
+ }());
394
398
 
395
399
  var GanttDate = /** @class */ (function () {
396
400
  function GanttDate(date) {
@@ -660,11 +664,24 @@
660
664
  return GanttGroupInternal;
661
665
  }());
662
666
 
667
+ var defaultConfig = {
668
+ dateFormat: {
669
+ week: '第w周',
670
+ month: 'M月',
671
+ quarter: 'QQQ',
672
+ year: 'yyyy年',
673
+ yearMonth: 'yyyy年MM月',
674
+ yearQuarter: 'yyyy年QQQ',
675
+ }
676
+ };
677
+ var GANTT_GLOBAL_CONFIG = new i0.InjectionToken('GANTT_GLOBAL_CONFIG');
678
+
663
679
  var primaryDatePointTop = 18;
664
680
  var secondaryDatePointTop = 36;
665
681
  var viewOptions$5 = {
666
682
  min: new GanttDate().addYears(-1).startOfYear(),
667
- max: new GanttDate().addYears(1).endOfYear()
683
+ max: new GanttDate().addYears(1).endOfYear(),
684
+ dateFormat: defaultConfig.dateFormat
668
685
  };
669
686
  var GanttView = /** @class */ (function () {
670
687
  function GanttView(start, end, options) {
@@ -817,7 +834,7 @@
817
834
  var points = [];
818
835
  for (var i = 0; i < quarters; i++) {
819
836
  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);
837
+ var point = new GanttDatePoint(start, start.format(this.options.dateFormat.yearQuarter), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
821
838
  points.push(point);
822
839
  }
823
840
  return points;
@@ -827,7 +844,7 @@
827
844
  var points = [];
828
845
  for (var i = 0; i < months.length; i++) {
829
846
  var start = new GanttDate(months[i]);
830
- var point = new GanttDatePoint(start, start.getMonth() + 1 + "\u6708", i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
847
+ var point = new GanttDatePoint(start, start.format(this.options.dateFormat.month), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
831
848
  points.push(point);
832
849
  }
833
850
  return points;
@@ -866,7 +883,7 @@
866
883
  var points = [];
867
884
  for (var i = 0; i < years.length; i++) {
868
885
  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);
886
+ var point = new GanttDatePoint(start, "" + start.format(this.options.dateFormat.year), (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
870
887
  points.push(point);
871
888
  }
872
889
  return points;
@@ -876,7 +893,7 @@
876
893
  var points = [];
877
894
  for (var i = 0; i <= quarters; i++) {
878
895
  var start = this.start.addQuarters(i);
879
- var point = new GanttDatePoint(start, start.format('QQQ'), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
896
+ var point = new GanttDatePoint(start, start.format(this.options.dateFormat.quarter), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
880
897
  points.push(point);
881
898
  }
882
899
  return points;
@@ -917,7 +934,7 @@
917
934
  for (var i = 0; i < weeks.length; i++) {
918
935
  var weekStart = new GanttDate(weeks[i]);
919
936
  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);
937
+ var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.yearMonth), (this.getCellWidth() * 7) / 2 + i * (this.getCellWidth() * 7), primaryDatePointTop);
921
938
  points.push(point);
922
939
  }
923
940
  return points;
@@ -968,7 +985,7 @@
968
985
  for (var i = 0; i < weeks.length; i++) {
969
986
  var weekStart = new GanttDate(weeks[i]);
970
987
  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);
988
+ var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.year), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
972
989
  points.push(point);
973
990
  }
974
991
  return points;
@@ -978,7 +995,7 @@
978
995
  var points = [];
979
996
  for (var i = 0; i < weeks.length; i++) {
980
997
  var start = new GanttDate(weeks[i]);
981
- var point = new GanttDatePoint(start, "\u7B2C" + start.format('w') + "\u5468", i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
998
+ var point = new GanttDatePoint(start, "" + start.format(this.options.dateFormat.week), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
982
999
  points.push(point);
983
1000
  }
984
1001
  return points;
@@ -1026,7 +1043,7 @@
1026
1043
  var pointTop = 27;
1027
1044
  for (var i = 0; i <= years; i++) {
1028
1045
  var start = this.start.addYears(i);
1029
- var point = new GanttDatePoint(start, start.format('yyyy') + "\u5E74", i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
1046
+ var point = new GanttDatePoint(start, "" + start.format(this.options.dateFormat.year), i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
1030
1047
  points.push(point);
1031
1048
  }
1032
1049
  return points;
@@ -1101,40 +1118,43 @@
1101
1118
  return pre.concat(Array.isArray(cur) ? flatten(cur) : cur);
1102
1119
  }, []);
1103
1120
  }
1104
- function recursiveItems(items, level) {
1121
+ function recursiveItems(items) {
1105
1122
  var result = [];
1106
1123
  (items || []).forEach(function (item) {
1107
- item.level = level;
1108
1124
  result.push(item);
1109
1125
  if (item.expanded && item.children) {
1110
- result.push.apply(result, __spreadArray([], __read(recursiveItems(item.children, level + 1))));
1126
+ result.push.apply(result, __spreadArray([], __read(recursiveItems(item.children))));
1111
1127
  }
1112
1128
  });
1113
1129
  return result;
1114
1130
  }
1115
- function keyBy(array, key) {
1116
- var result = {};
1117
- array.forEach(function (item) {
1118
- var keyValue = item[key];
1119
- result[keyValue] = item;
1131
+ function getFlatItems(items) {
1132
+ var result = [];
1133
+ (items || []).forEach(function (item) {
1134
+ result.push(item);
1135
+ if (item.children) {
1136
+ result.push.apply(result, __spreadArray([], __read(getFlatItems(item.children))));
1137
+ }
1120
1138
  });
1121
1139
  return result;
1122
1140
  }
1123
1141
 
1124
1142
  var GanttUpper = /** @class */ (function () {
1125
- function GanttUpper(elementRef, cdr, ngZone) {
1143
+ function GanttUpper(elementRef, cdr, ngZone, config) {
1126
1144
  this.elementRef = elementRef;
1127
1145
  this.cdr = cdr;
1128
1146
  this.ngZone = ngZone;
1147
+ this.config = config;
1129
1148
  this.originItems = [];
1130
1149
  this.originGroups = [];
1131
1150
  this.viewType = exports.GanttViewType.month;
1132
1151
  this.showTodayLine = true;
1152
+ this.viewOptions = {};
1133
1153
  this.loadOnScroll = new i0.EventEmitter();
1134
1154
  this.dragStarted = new i0.EventEmitter();
1155
+ this.dragMoved = new i0.EventEmitter();
1135
1156
  this.dragEnded = new i0.EventEmitter();
1136
1157
  this.barClick = new i0.EventEmitter();
1137
- this.computeAllRefs = true;
1138
1158
  this.linkDragEnded = new i0.EventEmitter();
1139
1159
  this.items = [];
1140
1160
  this.groups = [];
@@ -1142,9 +1162,40 @@
1142
1162
  this.expandChange = new i0.EventEmitter();
1143
1163
  this.firstChange = true;
1144
1164
  this.unsubscribe$ = new rxjs.Subject();
1145
- this.expandedItemIds = [];
1165
+ this._selectable = false;
1166
+ this._multiple = false;
1146
1167
  this.ganttClass = true;
1147
1168
  }
1169
+ Object.defineProperty(GanttUpper.prototype, "selectable", {
1170
+ get: function () {
1171
+ return this._selectable;
1172
+ },
1173
+ set: function (value) {
1174
+ var _a;
1175
+ this._selectable = coercion.coerceBooleanProperty(value);
1176
+ if (this._selectable) {
1177
+ this.selectionModel = this.initSelectionModel();
1178
+ }
1179
+ else {
1180
+ (_a = this.selectionModel) === null || _a === void 0 ? void 0 : _a.clear();
1181
+ }
1182
+ },
1183
+ enumerable: false,
1184
+ configurable: true
1185
+ });
1186
+ Object.defineProperty(GanttUpper.prototype, "multiple", {
1187
+ get: function () {
1188
+ return this._multiple;
1189
+ },
1190
+ set: function (value) {
1191
+ this._multiple = coercion.coerceBooleanProperty(value);
1192
+ if (this.selectable) {
1193
+ this.selectionModel = this.initSelectionModel();
1194
+ }
1195
+ },
1196
+ enumerable: false,
1197
+ configurable: true
1198
+ });
1148
1199
  Object.defineProperty(GanttUpper.prototype, "element", {
1149
1200
  get: function () {
1150
1201
  return this.elementRef.nativeElement;
@@ -1171,21 +1222,6 @@
1171
1222
  GanttUpper.prototype.setupItems = function () {
1172
1223
  var _this = this;
1173
1224
  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
1225
  this.items = [];
1190
1226
  if (this.groups.length > 0) {
1191
1227
  this.originItems.forEach(function (origin) {
@@ -1204,18 +1240,23 @@
1204
1240
  }
1205
1241
  };
1206
1242
  GanttUpper.prototype.setupExpandedState = function () {
1207
- var _this = this;
1243
+ this.originItems = uniqBy(this.originItems, 'id');
1208
1244
  var items = [];
1245
+ var flatOriginItems = getFlatItems(this.originItems);
1209
1246
  if (this.items.length > 0) {
1210
1247
  items = recursiveItems(this.items);
1211
1248
  }
1212
1249
  else {
1213
1250
  items = flatten(this.groups.map(function (group) { return recursiveItems(group.items); }));
1214
1251
  }
1215
- this.expandedItemIds = [];
1216
1252
  items.forEach(function (item) {
1217
1253
  if (item.origin.expanded) {
1218
- _this.expandedItemIds.push(item.id);
1254
+ var newItem = flatOriginItems.find(function (originItem) { return originItem.id === item.id; });
1255
+ if (newItem) {
1256
+ if (newItem.expanded === undefined) {
1257
+ newItem.expanded = true;
1258
+ }
1259
+ }
1219
1260
  }
1220
1261
  });
1221
1262
  };
@@ -1246,28 +1287,41 @@
1246
1287
  };
1247
1288
  GanttUpper.prototype.computeRefs = function () {
1248
1289
  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
- }
1290
+ this.groups.forEach(function (group) {
1291
+ var groupItems = recursiveItems(group.items);
1292
+ _this.computeItemsRefs.apply(_this, __spreadArray([], __read(groupItems)));
1293
+ });
1294
+ var items = recursiveItems(this.items);
1295
+ this.computeItemsRefs.apply(this, __spreadArray([], __read(items)));
1296
+ };
1297
+ GanttUpper.prototype.expandGroups = function (expanded) {
1298
+ this.groups.forEach(function (group) {
1299
+ group.setExpand(expanded);
1300
+ });
1301
+ this.expandChange.next();
1302
+ this.cdr.detectChanges();
1303
+ };
1304
+ GanttUpper.prototype.initSelectionModel = function () {
1305
+ return new collections.SelectionModel(this.multiple, []);
1257
1306
  };
1258
1307
  GanttUpper.prototype.onInit = function () {
1259
1308
  var _this = this;
1260
1309
  this.styles = Object.assign({}, defaultStyles, this.styles);
1310
+ this.viewOptions.dateFormat = Object.assign({}, defaultConfig.dateFormat, this.config.dateFormat, this.viewOptions.dateFormat);
1261
1311
  this.createView();
1262
1312
  this.setupGroups();
1263
1313
  this.setupItems();
1264
1314
  this.computeRefs();
1315
+ this.initSelectionModel();
1265
1316
  this.firstChange = false;
1266
1317
  this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
1267
1318
  _this.element.style.opacity = '1';
1268
1319
  _this.dragContainer.dragStarted.subscribe(function (event) {
1269
1320
  _this.dragStarted.emit(event);
1270
1321
  });
1322
+ _this.dragContainer.dragMoved.subscribe(function (event) {
1323
+ _this.dragMoved.emit(event);
1324
+ });
1271
1325
  _this.dragContainer.dragEnded.subscribe(function (event) {
1272
1326
  _this.dragEnded.emit(event);
1273
1327
  _this.computeRefs();
@@ -1313,19 +1367,58 @@
1313
1367
  });
1314
1368
  });
1315
1369
  };
1316
- GanttUpper.prototype.trackBy = function (item, index) {
1370
+ GanttUpper.prototype.trackBy = function (index, item) {
1317
1371
  return item.id || index;
1318
1372
  };
1319
1373
  GanttUpper.prototype.detectChanges = function () {
1320
1374
  this.cdr.detectChanges();
1321
1375
  };
1376
+ GanttUpper.prototype.expandGroup = function (group) {
1377
+ group.setExpand(!group.expanded);
1378
+ this.expandChange.emit();
1379
+ this.cdr.detectChanges();
1380
+ };
1381
+ // public functions
1382
+ GanttUpper.prototype.expandAll = function () {
1383
+ this.expandGroups(true);
1384
+ };
1385
+ GanttUpper.prototype.collapseAll = function () {
1386
+ this.expandGroups(false);
1387
+ };
1388
+ GanttUpper.prototype.getGanttItem = function (id) {
1389
+ return this.getGanttItems([id])[0] || null;
1390
+ };
1391
+ GanttUpper.prototype.getGanttItems = function (ids) {
1392
+ var items = [];
1393
+ if (this.items.length > 0) {
1394
+ items = recursiveItems(this.items);
1395
+ }
1396
+ else {
1397
+ items = flatten(this.groups.map(function (group) { return recursiveItems(group.items); }));
1398
+ }
1399
+ return items.filter(function (item) { return ids.includes(item.id); });
1400
+ };
1401
+ GanttUpper.prototype.isSelected = function (id) {
1402
+ if (!this.selectable) {
1403
+ return false;
1404
+ }
1405
+ if (!this.selectionModel.hasValue()) {
1406
+ return false;
1407
+ }
1408
+ return this.selectionModel.isSelected(id);
1409
+ };
1322
1410
  return GanttUpper;
1323
1411
  }());
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 });
1412
+ 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 });
1413
+ 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", selectable: "selectable", multiple: "multiple" }, 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
1414
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttUpper, decorators: [{
1327
1415
  type: i0.Directive
1328
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }]; }, propDecorators: { originItems: [{
1416
+ }], ctorParameters: function () {
1417
+ return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }, { type: undefined, decorators: [{
1418
+ type: i0.Inject,
1419
+ args: [GANTT_GLOBAL_CONFIG]
1420
+ }] }];
1421
+ }, propDecorators: { originItems: [{
1329
1422
  type: i0.Input,
1330
1423
  args: ['items']
1331
1424
  }], originGroups: [{
@@ -1347,10 +1440,16 @@
1347
1440
  type: i0.Input
1348
1441
  }], disabledLoadOnScroll: [{
1349
1442
  type: i0.Input
1443
+ }], selectable: [{
1444
+ type: i0.Input
1445
+ }], multiple: [{
1446
+ type: i0.Input
1350
1447
  }], loadOnScroll: [{
1351
1448
  type: i0.Output
1352
1449
  }], dragStarted: [{
1353
1450
  type: i0.Output
1451
+ }], dragMoved: [{
1452
+ type: i0.Output
1354
1453
  }], dragEnded: [{
1355
1454
  type: i0.Output
1356
1455
  }], barClick: [{
@@ -1423,7 +1522,7 @@
1423
1522
  return NgxGanttTableComponent;
1424
1523
  }());
1425
1524
  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 });
1525
+ 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
1526
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttTableComponent, decorators: [{
1428
1527
  type: i0.Component,
1429
1528
  args: [{
@@ -1432,183 +1531,132 @@
1432
1531
  }]
1433
1532
  }], ctorParameters: function () { return []; }, propDecorators: { columnChanges: [{
1434
1533
  type: i0.Output
1534
+ }], rowBeforeTemplate: [{
1535
+ type: i0.ContentChild,
1536
+ args: ['rowBeforeSlot', { static: true }]
1537
+ }], rowAfterTemplate: [{
1538
+ type: i0.ContentChild,
1539
+ args: ['rowAfterSlot', { static: true }]
1435
1540
  }] } });
1436
1541
 
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();
1542
+ var GANTT_ABSTRACT_TOKEN = new i0.InjectionToken('gantt-abstract-token');
1543
+
1544
+ 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>";
1545
+ 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>";
1546
+ 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>";
1547
+ 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>";
1548
+ 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>";
1549
+ 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>";
1550
+ var icons = {
1551
+ 'angle-right': angleRight,
1552
+ 'angle-down': angleDown,
1553
+ 'plus-square': plusSquare,
1554
+ 'minus-square': minusSquare,
1555
+ loading: loadingIcon,
1556
+ empty: emptyIcon
1557
+ };
1558
+
1559
+ var GanttIconComponent = /** @class */ (function () {
1560
+ function GanttIconComponent(elementRef) {
1561
+ this.elementRef = elementRef;
1562
+ this.isIcon = true;
1447
1563
  }
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;
1564
+ Object.defineProperty(GanttIconComponent.prototype, "iconName", {
1565
+ set: function (name) {
1566
+ this.setSvg(name);
1567
+ },
1568
+ enumerable: false,
1569
+ configurable: true
1570
+ });
1571
+ GanttIconComponent.prototype.ngOnInit = function () { };
1572
+ GanttIconComponent.prototype.ngAfterViewInit = function () { };
1573
+ GanttIconComponent.prototype.setSvg = function (name) {
1574
+ var iconSvg = icons[name];
1575
+ if (iconSvg) {
1576
+ this.elementRef.nativeElement.innerHTML = iconSvg;
1577
+ }
1578
+ else {
1579
+ this.elementRef.nativeElement.innerHTML = '';
1528
1580
  }
1529
1581
  };
1530
- GanttDomService.prototype.ngOnDestroy = function () {
1531
- this.unsubscribe$.next();
1532
- this.unsubscribe$.complete();
1533
- };
1534
- return GanttDomService;
1582
+ return GanttIconComponent;
1535
1583
  }());
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
- GanttDomServiceprov = 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 []; } });
1584
+ 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 });
1585
+ GanttIconComponentcmp = 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 });
1586
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttIconComponent, decorators: [{
1587
+ type: i0.Component,
1588
+ args: [{
1589
+ selector: 'gantt-icon',
1590
+ template: ''
1591
+ }]
1592
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { isIcon: [{
1593
+ type: i0.HostBinding,
1594
+ args: ['class.gantt-icon']
1595
+ }], iconName: [{
1596
+ type: i0.Input
1597
+ }] } });
1541
1598
 
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();
1599
+ var IsGanttRangeItemPipe = /** @class */ (function () {
1600
+ function IsGanttRangeItemPipe() {
1549
1601
  }
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
- });
1602
+ IsGanttRangeItemPipe.prototype.transform = function (value) {
1603
+ return value === exports.GanttItemType.range;
1559
1604
  };
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
- }
1605
+ return IsGanttRangeItemPipe;
1606
+ }());
1607
+ IsGanttRangeItemPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttRangeItemPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1608
+ IsGanttRangeItemPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1609
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttRangeItemPipe, decorators: [{
1610
+ type: i0.Pipe,
1611
+ args: [{
1612
+ name: 'isGanttRangeItem'
1613
+ }]
1614
+ }] });
1615
+ var IsGanttBarItemPipe = /** @class */ (function () {
1616
+ function IsGanttBarItemPipe() {
1617
+ }
1618
+ IsGanttBarItemPipe.prototype.transform = function (value) {
1619
+ return value === exports.GanttItemType.bar;
1579
1620
  };
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;
1621
+ return IsGanttBarItemPipe;
1622
+ }());
1623
+ IsGanttBarItemPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttBarItemPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1624
+ IsGanttBarItemPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1625
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttBarItemPipe, decorators: [{
1626
+ type: i0.Pipe,
1627
+ args: [{
1628
+ name: 'isGanttBarItem'
1629
+ }]
1630
+ }] });
1631
+ var IsGanttCustomItemPipe = /** @class */ (function () {
1632
+ function IsGanttCustomItemPipe() {
1633
+ }
1634
+ IsGanttCustomItemPipe.prototype.transform = function (value) {
1635
+ return value === exports.GanttItemType.custom;
1591
1636
  };
1592
- return GanttDragContainer;
1637
+ return IsGanttCustomItemPipe;
1593
1638
  }());
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
- GanttDragContainerprov = 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
- var GANTT_ABSTRACT_TOKEN = new i0.InjectionToken('gantt-abstract-token');
1639
+ IsGanttCustomItemPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttCustomItemPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1640
+ IsGanttCustomItemPipepipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1641
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttCustomItemPipe, decorators: [{
1642
+ type: i0.Pipe,
1643
+ args: [{
1644
+ name: 'isGanttCustomItem'
1645
+ }]
1646
+ }] });
1601
1647
 
1602
1648
  var defaultColumnWidth = 100;
1603
1649
  var minColumnWidth = 80;
1604
- var GanttTableHeaderComponent = /** @class */ (function () {
1605
- function GanttTableHeaderComponent(elementRef, gantt) {
1606
- this.elementRef = elementRef;
1650
+ var GanttTableComponent = /** @class */ (function () {
1651
+ function GanttTableComponent(gantt, ganttUpper, elementRef) {
1607
1652
  this.gantt = gantt;
1608
- this.tableWidth = 0;
1609
- this.className = "gantt-table-header gantt-table-row";
1653
+ this.ganttUpper = ganttUpper;
1654
+ this.elementRef = elementRef;
1655
+ this.itemClick = new i0.EventEmitter();
1656
+ this.ganttTableClass = true;
1657
+ this.ganttTableEmptyClass = false;
1610
1658
  }
1611
- Object.defineProperty(GanttTableHeaderComponent.prototype, "columns", {
1659
+ Object.defineProperty(GanttTableComponent.prototype, "columns", {
1612
1660
  set: function (columns) {
1613
1661
  columns.forEach(function (column) {
1614
1662
  if (!column.columnWidth) {
@@ -1620,20 +1668,33 @@
1620
1668
  enumerable: false,
1621
1669
  configurable: true
1622
1670
  });
1623
- GanttTableHeaderComponent.prototype.ngOnInit = function () { };
1624
- GanttTableHeaderComponent.prototype.ngAfterViewInit = function () {
1625
- this.tableWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
1671
+ GanttTableComponent.prototype.ngOnInit = function () { };
1672
+ GanttTableComponent.prototype.ngOnChanges = function (changes) {
1673
+ var _a, _b;
1674
+ 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)) {
1675
+ this.ganttTableEmptyClass = true;
1676
+ }
1677
+ else {
1678
+ this.ganttTableEmptyClass = false;
1679
+ }
1626
1680
  };
1627
- GanttTableHeaderComponent.prototype.dragFixed = function (config) {
1681
+ GanttTableComponent.prototype.dragFixed = function (config) {
1628
1682
  if (config.movedWidth < config.minWidth) {
1629
1683
  config.target.style.transform = "translate3d(" + (config.minWidth - config.originWidth) + "px, 0, 0)";
1630
1684
  }
1631
1685
  };
1632
- GanttTableHeaderComponent.prototype.dragStarted = function (event) {
1686
+ GanttTableComponent.prototype.expandGroup = function (group) {
1687
+ this.gantt.expandGroup(group);
1688
+ };
1689
+ GanttTableComponent.prototype.expandChildren = function (event, item) {
1690
+ event.stopPropagation();
1691
+ this.gantt.expandChildren(item);
1692
+ };
1693
+ GanttTableComponent.prototype.dragStarted = function (event) {
1633
1694
  var target = event.source.element.nativeElement;
1634
1695
  this.dragStartLeft = target.getBoundingClientRect().left;
1635
1696
  };
1636
- GanttTableHeaderComponent.prototype.dragMoved = function (event, column) {
1697
+ GanttTableComponent.prototype.dragMoved = function (event, column) {
1637
1698
  var target = event.source.element.nativeElement;
1638
1699
  var left = target.getBoundingClientRect().left;
1639
1700
  var originWidth;
@@ -1657,8 +1718,7 @@
1657
1718
  });
1658
1719
  this.showAuxiliaryLine(event);
1659
1720
  };
1660
- GanttTableHeaderComponent.prototype.columnDragEnded = function (event, column) {
1661
- var beforeWidth = parseInt(column.columnWidth, 10);
1721
+ GanttTableComponent.prototype.columnDragEnded = function (event, column) {
1662
1722
  var target = event.source.element.nativeElement;
1663
1723
  var left = target.getBoundingClientRect().left;
1664
1724
  var width = parseInt(column.columnWidth, 10) + (left - this.dragStartLeft);
@@ -1667,168 +1727,348 @@
1667
1727
  if (this.gantt.table) {
1668
1728
  this.gantt.table.columnChanges.emit({ columns: this.columnList });
1669
1729
  }
1670
- this.tableWidth = this.tableWidth - beforeWidth + columnWidth;
1671
1730
  this.hideAuxiliaryLine();
1672
1731
  event.source.reset();
1673
1732
  };
1674
- GanttTableHeaderComponent.prototype.tableDragEnded = function (event) {
1733
+ GanttTableComponent.prototype.tableDragEnded = function (event) {
1675
1734
  var target = event.source.element.nativeElement;
1676
1735
  var left = target.getBoundingClientRect().left;
1677
1736
  var tableWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
1678
1737
  var dragWidth = left - this.dragStartLeft;
1679
- var tempWidth = 0;
1680
1738
  this.columnList.forEach(function (column) {
1681
1739
  var lastColumnWidth = parseInt(column.columnWidth, 10);
1682
1740
  var distributeWidth = parseInt(String(dragWidth * (lastColumnWidth / tableWidth)), 10);
1683
1741
  var columnWidth = Math.max(lastColumnWidth + distributeWidth || 0, minColumnWidth);
1684
1742
  column.columnWidth = coercion.coerceCssPixelValue(columnWidth);
1685
- tempWidth += columnWidth;
1686
1743
  });
1687
- this.tableWidth = tempWidth;
1688
1744
  if (this.gantt.table) {
1689
1745
  this.gantt.table.columnChanges.emit({ columns: this.columnList });
1690
1746
  }
1691
1747
  this.hideAuxiliaryLine();
1692
1748
  event.source.reset();
1693
1749
  };
1694
- GanttTableHeaderComponent.prototype.showAuxiliaryLine = function (event) {
1750
+ GanttTableComponent.prototype.showAuxiliaryLine = function (event) {
1695
1751
  var tableRect = this.elementRef.nativeElement.getBoundingClientRect();
1696
1752
  var targetRect = event.source.element.nativeElement.getBoundingClientRect();
1697
1753
  var distance = { x: targetRect.left - tableRect.left, y: targetRect.top - tableRect.top };
1698
1754
  this.draglineElementRef.nativeElement.style.left = distance.x + "px";
1699
1755
  this.draglineElementRef.nativeElement.style.display = 'block';
1700
1756
  };
1701
- GanttTableHeaderComponent.prototype.hideAuxiliaryLine = function () {
1757
+ GanttTableComponent.prototype.hideAuxiliaryLine = function () {
1702
1758
  this.draglineElementRef.nativeElement.style.display = 'none';
1703
1759
  };
1704
- return GanttTableHeaderComponent;
1760
+ GanttTableComponent.prototype.trackBy = function (index, item) {
1761
+ return item.id || index;
1762
+ };
1763
+ return GanttTableComponent;
1705
1764
  }());
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: [{
1765
+ GanttTableComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttTableComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }, { token: GANTT_UPPER_TOKEN }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1766
+ 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" }, outputs: { itemClick: "itemClick" }, 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 (click)=\"itemClick.emit({ event: $event, selectedValue: this.item.origin })\"\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 [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\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($event, 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 } });
1767
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttTableComponent, decorators: [{
1709
1768
  type: i0.Component,
1710
1769
  args: [{
1711
- selector: 'gantt-table-header',
1712
- templateUrl: './gantt-table-header.component.html'
1770
+ selector: 'gantt-table',
1771
+ templateUrl: './gantt-table.component.html'
1713
1772
  }]
1714
1773
  }], ctorParameters: function () {
1715
- return [{ type: i0__namespace.ElementRef }, { type: undefined, decorators: [{
1774
+ return [{ type: undefined, decorators: [{
1716
1775
  type: i0.Inject,
1717
1776
  args: [GANTT_ABSTRACT_TOKEN]
1718
- }] }];
1719
- }, propDecorators: { columns: [{
1777
+ }] }, { type: GanttUpper, decorators: [{
1778
+ type: i0.Inject,
1779
+ args: [GANTT_UPPER_TOKEN]
1780
+ }] }, { type: i0__namespace.ElementRef }];
1781
+ }, propDecorators: { groups: [{
1782
+ type: i0.Input
1783
+ }], items: [{
1784
+ type: i0.Input
1785
+ }], columns: [{
1786
+ type: i0.Input
1787
+ }], groupTemplate: [{
1788
+ type: i0.Input
1789
+ }], emptyTemplate: [{
1790
+ type: i0.Input
1791
+ }], rowBeforeTemplate: [{
1792
+ type: i0.Input
1793
+ }], rowAfterTemplate: [{
1720
1794
  type: i0.Input
1795
+ }], itemClick: [{
1796
+ type: i0.Output
1721
1797
  }], draglineElementRef: [{
1722
1798
  type: i0.ViewChild,
1723
1799
  args: ['dragLine', { static: true }]
1724
- }], className: [{
1800
+ }], ganttTableClass: [{
1801
+ type: i0.HostBinding,
1802
+ args: ['class.gantt-table']
1803
+ }], ganttTableEmptyClass: [{
1725
1804
  type: i0.HostBinding,
1726
- args: ['class']
1805
+ args: ['class.gantt-table-empty']
1727
1806
  }] } });
1728
1807
 
1729
- var GanttPrintService = /** @class */ (function () {
1730
- function GanttPrintService() {
1808
+ var scrollThreshold = 50;
1809
+ var ScrollDirection;
1810
+ (function (ScrollDirection) {
1811
+ ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1812
+ ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1813
+ ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1814
+ })(ScrollDirection || (ScrollDirection = {}));
1815
+ var GanttDomService = /** @class */ (function () {
1816
+ function GanttDomService() {
1817
+ this.unsubscribe$ = new rxjs.Subject();
1731
1818
  }
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
- }
1819
+ GanttDomService.prototype.monitorScrollChange = function () {
1820
+ var _this = this;
1821
+ rxjs.merge(rxjs.fromEvent(this.mainContainer, 'scroll'), rxjs.fromEvent(this.sideContainer, 'scroll'))
1822
+ .pipe(operators.takeUntil(this.unsubscribe$))
1823
+ .subscribe(function (event) {
1824
+ _this.syncScroll(event);
1825
+ });
1826
+ rxjs.fromEvent(this.mainContainer, 'scroll')
1827
+ .pipe(operators.startWith(), operators.takeUntil(this.unsubscribe$))
1828
+ .subscribe(function (event) {
1829
+ // if (this.mainContainer.scrollLeft > 0) {
1830
+ // this.side.classList.add('gantt-side-has-shadow');
1831
+ // } else {
1832
+ // this.side.classList.remove('gantt-side-has-shadow');
1833
+ // }
1834
+ });
1748
1835
  };
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);
1836
+ GanttDomService.prototype.syncScroll = function (event) {
1837
+ var target = event.currentTarget;
1838
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1839
+ this.sideContainer.scrollTop = target.scrollTop;
1840
+ this.mainContainer.scrollTop = target.scrollTop;
1841
+ };
1842
+ GanttDomService.prototype.disableBrowserWheelEvent = function () {
1843
+ var container = this.mainContainer;
1844
+ rxjs.fromEvent(container, 'wheel')
1845
+ .pipe(operators.takeUntil(this.unsubscribe$))
1846
+ .subscribe(function (event) {
1847
+ var delta = event.deltaX;
1848
+ if (!delta) {
1849
+ return;
1783
1850
  }
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);
1851
+ if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1852
+ (container.scrollLeft === 0 && delta < 0)) {
1853
+ event.preventDefault();
1789
1854
  }
1790
- finally { if (e_3) throw e_3.error; }
1791
- }
1855
+ });
1792
1856
  };
1793
- GanttPrintService.prototype.register = function (root) {
1857
+ GanttDomService.prototype.initialize = function (root) {
1794
1858
  this.root = root.nativeElement;
1859
+ this.side = this.root.getElementsByClassName('gantt-side')[0];
1860
+ this.container = this.root.getElementsByClassName('gantt-container')[0];
1861
+ this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
1795
1862
  this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1863
+ this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-overlay')[0];
1864
+ this.monitorScrollChange();
1865
+ this.disableBrowserWheelEvent();
1796
1866
  };
1797
- GanttPrintService.prototype.print = function (name, ignoreElementClass) {
1867
+ GanttDomService.prototype.getViewerScroll = function () {
1798
1868
  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;
1869
+ return rxjs.fromEvent(this.mainContainer, 'scroll').pipe(operators.map(function () { return _this.mainContainer.scrollLeft; }), operators.pairwise(), operators.map(function (_a) {
1870
+ var _b = __read(_a, 2), previous = _b[0], current = _b[1];
1871
+ var event = {
1872
+ target: _this.mainContainer,
1873
+ direction: ScrollDirection.NONE
1874
+ };
1875
+ if (current - previous < 0) {
1876
+ if (_this.mainContainer.scrollLeft < scrollThreshold && _this.mainContainer.scrollLeft > 0) {
1877
+ event.direction = ScrollDirection.LEFT;
1815
1878
  }
1816
- if (element.classList.contains('gantt-calendar-today-overlay')) {
1817
- return true;
1879
+ }
1880
+ if (current - previous > 0) {
1881
+ if (_this.mainContainer.scrollWidth - _this.mainContainer.clientWidth - _this.mainContainer.scrollLeft < scrollThreshold) {
1882
+ event.direction = ScrollDirection.RIGHT;
1818
1883
  }
1819
- },
1820
- onclone: function (cloneDocument) {
1821
- var ganttClass = root.className;
1822
- var cloneGanttDom = cloneDocument.querySelector("." + ganttClass.replace(/\s+/g, '.'));
1823
- var cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
1824
- var cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-grid-main');
1825
- var cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
1826
- // change targetDom width
1827
- cloneGanttDom.style.width = printWidth + "px";
1828
- cloneGanttDom.style.height = printHeight + "px";
1829
- cloneGanttDom.style.overflow = "unset";
1830
- cloneGanttContainerDom.style.backgroundColor = '#fff';
1831
- cloneCalendarOverlay.setAttribute('height', "" + printHeight);
1884
+ }
1885
+ return event;
1886
+ }));
1887
+ };
1888
+ GanttDomService.prototype.getResize = function () {
1889
+ return rxjs.fromEvent(window, 'resize').pipe(operators.auditTime(150));
1890
+ };
1891
+ GanttDomService.prototype.scrollMainContainer = function (left) {
1892
+ if (isNumber(left)) {
1893
+ var scrollLeft = left - this.mainContainer.clientWidth / 2;
1894
+ this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
1895
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1896
+ }
1897
+ };
1898
+ GanttDomService.prototype.ngOnDestroy = function () {
1899
+ this.unsubscribe$.next();
1900
+ this.unsubscribe$.complete();
1901
+ };
1902
+ return GanttDomService;
1903
+ }());
1904
+ GanttDomService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1905
+ GanttDomService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService });
1906
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService, decorators: [{
1907
+ type: i0.Injectable
1908
+ }], ctorParameters: function () { return []; } });
1909
+
1910
+ var GanttDragContainer = /** @class */ (function () {
1911
+ function GanttDragContainer() {
1912
+ this.dragStarted = new i0.EventEmitter();
1913
+ this.dragMoved = new i0.EventEmitter();
1914
+ this.dragEnded = new i0.EventEmitter();
1915
+ this.linkDragStarted = new i0.EventEmitter();
1916
+ this.linkDragEntered = new i0.EventEmitter();
1917
+ this.linkDragEnded = new i0.EventEmitter();
1918
+ }
1919
+ GanttDragContainer.prototype.emitLinkDragStarted = function (from, item) {
1920
+ this.linkDraggingId = item.id;
1921
+ this.linkDragFrom = from;
1922
+ this.linkDragSource = this.linkDragFrom === 'source' ? item : null;
1923
+ this.linkDragTarget = this.linkDragFrom === 'target' ? item : null;
1924
+ this.linkDragStarted.emit({
1925
+ source: this.linkDragSource && this.linkDragSource.origin,
1926
+ target: this.linkDragTarget && this.linkDragTarget.origin
1927
+ });
1928
+ };
1929
+ GanttDragContainer.prototype.emitLinkDragEntered = function (item) {
1930
+ if (this.linkDragFrom === 'source') {
1931
+ this.linkDragTarget = item;
1932
+ }
1933
+ else {
1934
+ this.linkDragSource = item;
1935
+ }
1936
+ this.linkDragEntered.emit({
1937
+ source: this.linkDragSource.origin,
1938
+ target: this.linkDragTarget.origin
1939
+ });
1940
+ };
1941
+ GanttDragContainer.prototype.emitLinkDragLeaved = function () {
1942
+ if (this.linkDragFrom === 'source') {
1943
+ this.linkDragTarget = null;
1944
+ }
1945
+ else {
1946
+ this.linkDragSource = null;
1947
+ }
1948
+ };
1949
+ GanttDragContainer.prototype.emitLinkDragEnded = function () {
1950
+ this.linkDraggingId = null;
1951
+ if (this.linkDragSource && this.linkDragTarget) {
1952
+ this.linkDragSource.addLink(this.linkDragTarget.id);
1953
+ this.linkDragEnded.emit({
1954
+ source: this.linkDragSource.origin,
1955
+ target: this.linkDragTarget.origin
1956
+ });
1957
+ }
1958
+ this.linkDragSource = null;
1959
+ this.linkDragTarget = null;
1960
+ };
1961
+ return GanttDragContainer;
1962
+ }());
1963
+ GanttDragContainer.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1964
+ GanttDragContainer.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer });
1965
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer, decorators: [{
1966
+ type: i0.Injectable
1967
+ }], ctorParameters: function () { return []; } });
1968
+
1969
+ var GanttPrintService = /** @class */ (function () {
1970
+ function GanttPrintService() {
1971
+ }
1972
+ GanttPrintService.prototype.setInlineStyles = function (targetElem) {
1973
+ var e_1, _a;
1974
+ var svgElements = Array.from(targetElem.getElementsByTagName('svg'));
1975
+ try {
1976
+ for (var svgElements_1 = __values(svgElements), svgElements_1_1 = svgElements_1.next(); !svgElements_1_1.done; svgElements_1_1 = svgElements_1.next()) {
1977
+ var svgElement = svgElements_1_1.value;
1978
+ this.recursElementChildren(svgElement);
1979
+ }
1980
+ }
1981
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1982
+ finally {
1983
+ try {
1984
+ if (svgElements_1_1 && !svgElements_1_1.done && (_a = svgElements_1.return)) _a.call(svgElements_1);
1985
+ }
1986
+ finally { if (e_1) throw e_1.error; }
1987
+ }
1988
+ };
1989
+ GanttPrintService.prototype.recursElementChildren = function (node) {
1990
+ var e_2, _a, e_3, _b;
1991
+ var transformProperties = [
1992
+ 'fill',
1993
+ 'color',
1994
+ 'font-size',
1995
+ 'stroke',
1996
+ 'font',
1997
+ 'text-anchor',
1998
+ 'stroke-dasharray',
1999
+ 'shape-rendering',
2000
+ 'stroke-width'
2001
+ ];
2002
+ if (!node.style) {
2003
+ return;
2004
+ }
2005
+ var styles = getComputedStyle(node);
2006
+ try {
2007
+ for (var transformProperties_1 = __values(transformProperties), transformProperties_1_1 = transformProperties_1.next(); !transformProperties_1_1.done; transformProperties_1_1 = transformProperties_1.next()) {
2008
+ var transformProperty = transformProperties_1_1.value;
2009
+ node.style[transformProperty] = styles[transformProperty];
2010
+ }
2011
+ }
2012
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2013
+ finally {
2014
+ try {
2015
+ if (transformProperties_1_1 && !transformProperties_1_1.done && (_a = transformProperties_1.return)) _a.call(transformProperties_1);
2016
+ }
2017
+ finally { if (e_2) throw e_2.error; }
2018
+ }
2019
+ try {
2020
+ for (var _c = __values(Array.from(node.childNodes)), _d = _c.next(); !_d.done; _d = _c.next()) {
2021
+ var child = _d.value;
2022
+ this.recursElementChildren(child);
2023
+ }
2024
+ }
2025
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
2026
+ finally {
2027
+ try {
2028
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2029
+ }
2030
+ finally { if (e_3) throw e_3.error; }
2031
+ }
2032
+ };
2033
+ GanttPrintService.prototype.register = function (root) {
2034
+ this.root = root.nativeElement;
2035
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
2036
+ };
2037
+ GanttPrintService.prototype.print = function (name, ignoreElementClass) {
2038
+ var _this = this;
2039
+ if (name === void 0) { name = 'download'; }
2040
+ var root = this.root;
2041
+ var mainContainer = this.mainContainer;
2042
+ // set print width
2043
+ var printWidth = root.offsetWidth;
2044
+ // set print height
2045
+ var printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
2046
+ html2canvas__default['default'](root, {
2047
+ logging: false,
2048
+ allowTaint: true,
2049
+ useCORS: true,
2050
+ width: printWidth,
2051
+ height: printHeight,
2052
+ ignoreElements: function (element) {
2053
+ if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
2054
+ return true;
2055
+ }
2056
+ if (element.classList.contains('gantt-calendar-today-overlay')) {
2057
+ return true;
2058
+ }
2059
+ },
2060
+ onclone: function (cloneDocument) {
2061
+ var ganttClass = root.className;
2062
+ var cloneGanttDom = cloneDocument.querySelector("." + ganttClass.replace(/\s+/g, '.'));
2063
+ var cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
2064
+ var cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
2065
+ var cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
2066
+ // change targetDom width
2067
+ cloneGanttDom.style.width = printWidth + "px";
2068
+ cloneGanttDom.style.height = printHeight + "px";
2069
+ cloneGanttDom.style.overflow = "unset";
2070
+ cloneGanttContainerDom.style.backgroundColor = '#fff';
2071
+ cloneCalendarOverlay.setAttribute('height', "" + printHeight);
1832
2072
  cloneCalendarOverlay.setAttribute('style', "background: transparent");
1833
2073
  if (cloneLinksOverlay) {
1834
2074
  cloneLinksOverlay.setAttribute('height', "" + printHeight);
@@ -1853,62 +2093,78 @@
1853
2093
  type: i0.Injectable
1854
2094
  }], ctorParameters: function () { return []; } });
1855
2095
 
1856
- var GanttCalendarHeaderComponent = /** @class */ (function () {
1857
- function GanttCalendarHeaderComponent(ganttUpper, ngZone, elementRef) {
2096
+ var mainHeight = 5000;
2097
+ var GanttCalendarComponent = /** @class */ (function () {
2098
+ function GanttCalendarComponent(ganttUpper, ngZone, elementRef) {
1858
2099
  this.ganttUpper = ganttUpper;
1859
2100
  this.ngZone = ngZone;
1860
2101
  this.elementRef = elementRef;
1861
2102
  this.unsubscribe$ = new rxjs.Subject();
1862
2103
  this.headerHeight = headerHeight;
2104
+ this.mainHeight = mainHeight;
2105
+ this.todayHeight = todayHeight;
2106
+ this.todayWidth = todayWidth;
2107
+ this.todayBorderRadius = todayBorderRadius;
1863
2108
  this.viewTypes = exports.GanttViewType;
1864
- this.className = "gantt-calendar gantt-calendar-header";
2109
+ this.className = true;
1865
2110
  }
1866
- Object.defineProperty(GanttCalendarHeaderComponent.prototype, "view", {
2111
+ Object.defineProperty(GanttCalendarComponent.prototype, "view", {
1867
2112
  get: function () {
1868
2113
  return this.ganttUpper.view;
1869
2114
  },
1870
2115
  enumerable: false,
1871
2116
  configurable: true
1872
2117
  });
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 () {
2118
+ GanttCalendarComponent.prototype.setTodayPoint = function () {
1885
2119
  var x = this.view.getTodayXPoint();
1886
2120
  var today = new GanttDate().getDate();
1887
2121
  var todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
1888
2122
  var rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
2123
+ var line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
1889
2124
  if (isNumber(x)) {
1890
2125
  if (rect) {
1891
2126
  rect.style.left = x - todayWidth / 2 + "px";
1892
2127
  rect.style.top = headerHeight - todayHeight + "px";
1893
2128
  rect.innerHTML = today.toString();
1894
2129
  }
2130
+ if (line) {
2131
+ line.style.left = x + "px";
2132
+ line.style.top = headerHeight + "px";
2133
+ line.style.bottom = -mainHeight + "px";
2134
+ }
1895
2135
  }
1896
2136
  else {
1897
2137
  todayEle.style.display = 'none';
1898
2138
  }
1899
2139
  };
1900
- GanttCalendarHeaderComponent.prototype.trackBy = function (point, index) {
2140
+ GanttCalendarComponent.prototype.ngOnInit = function () {
2141
+ var _this = this;
2142
+ this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
2143
+ rxjs.merge(_this.ganttUpper.viewChange, _this.ganttUpper.view.start$)
2144
+ .pipe(operators.takeUntil(_this.unsubscribe$))
2145
+ .subscribe(function () {
2146
+ _this.setTodayPoint();
2147
+ });
2148
+ });
2149
+ };
2150
+ GanttCalendarComponent.prototype.ngAfterViewInit = function () { };
2151
+ GanttCalendarComponent.prototype.ngOnChanges = function (changes) { };
2152
+ GanttCalendarComponent.prototype.trackBy = function (index, point) {
1901
2153
  return point.text || index;
1902
2154
  };
1903
- return GanttCalendarHeaderComponent;
2155
+ GanttCalendarComponent.prototype.ngOnDestroy = function () {
2156
+ this.unsubscribe$.next();
2157
+ this.unsubscribe$.complete();
2158
+ };
2159
+ return GanttCalendarComponent;
1904
2160
  }());
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: [{
2161
+ 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 });
2162
+ 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"] }] });
2163
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttCalendarComponent, decorators: [{
1908
2164
  type: i0.Component,
1909
2165
  args: [{
1910
- selector: 'gantt-calendar-header',
1911
- templateUrl: './calendar-header.component.html'
2166
+ selector: 'gantt-calendar-overlay',
2167
+ templateUrl: './calendar.component.html'
1912
2168
  }]
1913
2169
  }], ctorParameters: function () {
1914
2170
  return [{ type: GanttUpper, decorators: [{
@@ -1917,256 +2173,146 @@
1917
2173
  }] }, { type: i0__namespace.NgZone }, { type: i0__namespace.ElementRef }];
1918
2174
  }, propDecorators: { className: [{
1919
2175
  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
2176
+ args: ['class.gantt-calendar-overlay']
1976
2177
  }] } });
1977
2178
 
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;
2179
+ var GanttDragBackdropComponent = /** @class */ (function () {
2180
+ function GanttDragBackdropComponent() {
2181
+ this.backdropClass = true;
2032
2182
  }
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;
2183
+ GanttDragBackdropComponent.prototype.ngOnInit = function () { };
2184
+ return GanttDragBackdropComponent;
2068
2185
  }());
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: [{
2186
+ GanttDragBackdropComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragBackdropComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
2187
+ 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" });
2188
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragBackdropComponent, decorators: [{
2072
2189
  type: i0.Component,
2073
2190
  args: [{
2074
- selector: 'gantt-table-body',
2075
- templateUrl: './gantt-table-body.component.html'
2191
+ selector: 'gantt-drag-backdrop',
2192
+ templateUrl: "./drag-backdrop.component.html"
2076
2193
  }]
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: [{
2194
+ }], ctorParameters: function () { return []; }, propDecorators: { backdropClass: [{
2094
2195
  type: i0.HostBinding,
2095
- args: ['class.gantt-table-empty']
2196
+ args: ['class.gantt-drag-backdrop']
2096
2197
  }] } });
2097
2198
 
2098
- var mainHeight = 5000;
2099
- var GanttCalendarGridComponent = /** @class */ (function () {
2100
- function GanttCalendarGridComponent(ganttUpper, ngZone, elementRef) {
2101
- this.ganttUpper = ganttUpper;
2102
- this.ngZone = ngZone;
2199
+ var NgxGanttRootComponent = /** @class */ (function () {
2200
+ function NgxGanttRootComponent(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
2103
2201
  this.elementRef = elementRef;
2202
+ this.ngZone = ngZone;
2203
+ this.dom = dom;
2204
+ this.dragContainer = dragContainer;
2205
+ this.ganttUpper = ganttUpper;
2206
+ this.printService = printService;
2207
+ this.ganttClass = true;
2104
2208
  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";
2209
+ this.ganttUpper.dragContainer = dragContainer;
2110
2210
  }
2111
- Object.defineProperty(GanttCalendarGridComponent.prototype, "view", {
2211
+ Object.defineProperty(NgxGanttRootComponent.prototype, "view", {
2112
2212
  get: function () {
2113
2213
  return this.ganttUpper.view;
2114
2214
  },
2115
2215
  enumerable: false,
2116
2216
  configurable: true
2117
2217
  });
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";
2218
+ NgxGanttRootComponent.prototype.ngOnInit = function () {
2219
+ var _this = this;
2220
+ this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
2221
+ _this.dom.initialize(_this.elementRef);
2222
+ if (_this.printService) {
2223
+ _this.printService.register(_this.elementRef);
2127
2224
  }
2225
+ _this.setupScrollClass();
2226
+ _this.setupResize();
2227
+ _this.setupViewScroll();
2228
+ // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2229
+ _this.elementRef.nativeElement.style.opacity = '1';
2230
+ _this.ganttUpper.viewChange.pipe(operators.startWith(null)).subscribe(function () {
2231
+ _this.scrollToToday();
2232
+ });
2233
+ });
2234
+ };
2235
+ NgxGanttRootComponent.prototype.setupViewScroll = function () {
2236
+ var _this = this;
2237
+ if (this.ganttUpper.disabledLoadOnScroll) {
2238
+ return;
2128
2239
  }
2129
- else {
2130
- todayEle.style.display = 'none';
2131
- }
2240
+ this.dom
2241
+ .getViewerScroll()
2242
+ .pipe(operators.takeUntil(this.unsubscribe$))
2243
+ .subscribe(function (event) {
2244
+ if (event.direction === ScrollDirection.LEFT) {
2245
+ var dates_1 = _this.view.addStartDate();
2246
+ if (dates_1) {
2247
+ event.target.scrollLeft += _this.view.getDateRangeWidth(dates_1.start, dates_1.end);
2248
+ _this.ngZone.run(function () {
2249
+ _this.ganttUpper.loadOnScroll.emit({ start: dates_1.start.getUnixTime(), end: dates_1.end.getUnixTime() });
2250
+ });
2251
+ }
2252
+ }
2253
+ if (event.direction === ScrollDirection.RIGHT) {
2254
+ var dates_2 = _this.view.addEndDate();
2255
+ if (dates_2) {
2256
+ _this.ngZone.run(function () {
2257
+ _this.ganttUpper.loadOnScroll.emit({ start: dates_2.start.getUnixTime(), end: dates_2.end.getUnixTime() });
2258
+ });
2259
+ }
2260
+ }
2261
+ });
2132
2262
  };
2133
- GanttCalendarGridComponent.prototype.ngOnInit = function () {
2263
+ NgxGanttRootComponent.prototype.setupResize = function () {
2134
2264
  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
- });
2265
+ this.dom
2266
+ .getResize()
2267
+ .pipe(operators.takeUntil(this.unsubscribe$))
2268
+ .subscribe(function () {
2269
+ _this.setupScrollClass();
2141
2270
  });
2142
2271
  };
2143
- GanttCalendarGridComponent.prototype.ngAfterViewInit = function () { };
2144
- GanttCalendarGridComponent.prototype.ngOnChanges = function (changes) { };
2145
- GanttCalendarGridComponent.prototype.trackBy = function (point, index) {
2146
- return point.text || index;
2272
+ NgxGanttRootComponent.prototype.setupScrollClass = function () {
2273
+ var mainContainer = this.dom.mainContainer;
2274
+ var height = mainContainer.offsetHeight;
2275
+ var scrollHeight = mainContainer.scrollHeight;
2276
+ if (scrollHeight > height) {
2277
+ this.elementRef.nativeElement.className = 'gantt gantt-scroll';
2278
+ }
2279
+ else {
2280
+ this.elementRef.nativeElement.className = 'gantt';
2281
+ }
2147
2282
  };
2148
- GanttCalendarGridComponent.prototype.ngOnDestroy = function () {
2149
- this.unsubscribe$.next();
2150
- this.unsubscribe$.complete();
2283
+ NgxGanttRootComponent.prototype.scrollToToday = function () {
2284
+ var x = this.view.getTodayXPoint();
2285
+ this.dom.scrollMainContainer(x);
2151
2286
  };
2152
- return GanttCalendarGridComponent;
2287
+ return NgxGanttRootComponent;
2153
2288
  }());
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: [{
2289
+ 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 });
2290
+ 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"] }] });
2291
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttRootComponent, decorators: [{
2157
2292
  type: i0.Component,
2158
2293
  args: [{
2159
- selector: 'gantt-calendar-grid',
2160
- templateUrl: './calendar-grid.component.html'
2294
+ selector: 'ngx-gantt-root',
2295
+ templateUrl: './root.component.html',
2296
+ providers: [GanttDomService, GanttDragContainer]
2161
2297
  }]
2162
2298
  }], ctorParameters: function () {
2163
- return [{ type: GanttUpper, decorators: [{
2299
+ return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
2164
2300
  type: i0.Inject,
2165
2301
  args: [GANTT_UPPER_TOKEN]
2166
- }] }, { type: i0__namespace.NgZone }, { type: i0__namespace.ElementRef }];
2167
- }, propDecorators: { className: [{
2302
+ }] }, { type: GanttPrintService, decorators: [{
2303
+ type: i0.Optional
2304
+ }] }];
2305
+ }, propDecorators: { sideWidth: [{
2306
+ type: i0.Input
2307
+ }], ganttClass: [{
2168
2308
  type: i0.HostBinding,
2169
- args: ['class']
2309
+ args: ['class.gantt']
2310
+ }], sideTemplate: [{
2311
+ type: i0.ContentChild,
2312
+ args: ['sideTemplate', { static: true }]
2313
+ }], mainTemplate: [{
2314
+ type: i0.ContentChild,
2315
+ args: ['mainTemplate', { static: true }]
2170
2316
  }] } });
2171
2317
 
2172
2318
  var LinkColors;
@@ -2181,7 +2327,8 @@
2181
2327
  this.cdr = cdr;
2182
2328
  this.elementRef = elementRef;
2183
2329
  this.ganttDragContainer = ganttDragContainer;
2184
- this.flatData = [];
2330
+ this.groups = [];
2331
+ this.items = [];
2185
2332
  this.lineClick = new i0.EventEmitter();
2186
2333
  this.links = [];
2187
2334
  this.linkItems = [];
@@ -2192,8 +2339,8 @@
2192
2339
  }
2193
2340
  GanttLinksComponent.prototype.ngOnInit = function () {
2194
2341
  var _this = this;
2195
- this.firstChange = false;
2196
2342
  this.buildLinks();
2343
+ this.firstChange = false;
2197
2344
  this.ganttDragContainer.dragStarted.pipe(operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2198
2345
  _this.elementRef.nativeElement.style.visibility = 'hidden';
2199
2346
  });
@@ -2215,21 +2362,40 @@
2215
2362
  var lineHeight = this.ganttUpper.styles.lineHeight;
2216
2363
  var barHeight = this.ganttUpper.styles.barHeight;
2217
2364
  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
- } }));
2365
+ if (this.groups.length > 0) {
2366
+ var itemNum_1 = 0;
2367
+ var groupNum_1 = 0;
2368
+ this.groups.forEach(function (group) {
2369
+ groupNum_1++;
2370
+ if (group.expanded) {
2371
+ var items = recursiveItems(group.items);
2372
+ items.forEach(function (item, itemIndex) {
2373
+ var y = (groupNum_1 + itemNum_1 + itemIndex) * lineHeight + item.refs.y + barHeight / 2;
2374
+ _this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
2375
+ x: item.refs.x,
2376
+ y: y
2377
+ }, after: {
2378
+ x: item.refs.x + item.refs.width,
2379
+ y: y
2380
+ } }));
2381
+ });
2382
+ itemNum_1 += items.length;
2230
2383
  }
2231
- }
2232
- });
2384
+ });
2385
+ }
2386
+ else {
2387
+ var items = recursiveItems(this.items);
2388
+ items.forEach(function (item, itemIndex) {
2389
+ var y = itemIndex * lineHeight + item.refs.y + barHeight / 2;
2390
+ _this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
2391
+ x: item.refs.x,
2392
+ y: y
2393
+ }, after: {
2394
+ x: item.refs.x + item.refs.width,
2395
+ y: y
2396
+ } }));
2397
+ });
2398
+ }
2233
2399
  };
2234
2400
  GanttLinksComponent.prototype.generatePath = function (source, target) {
2235
2401
  if (source.before && source.after && target.before && target.after) {
@@ -2314,7 +2480,7 @@
2314
2480
  return GanttLinksComponent;
2315
2481
  }());
2316
2482
  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"] }] });
2483
+ GanttLinksComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: { groups: "groups", items: "items" }, outputs: { lineClick: "lineClick" }, host: { properties: { "class.gantt-links-overlay": "this.ganttLinksOverlay" } }, usesOnChanges: true, ngImport: i0__namespace, template: "<svg [attr.width]=\"ganttUpper.view.width\" class=\"gantt-links-overlay-main\">\n <ng-container *ngFor=\"let link of links; let i = index; trackBy: trackBy\">\n <path [attr.d]=\"link.path\" fill=\"transparent\" stroke-width=\"2\" [attr.stroke]=\"link.color\" pointer-events=\"none\"></path>\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n (mouseenter)=\"mouseEnterPath(link)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n [attr.d]=\"link.path\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n </ng-container>\n <line class=\"link-dragging-line\"></line>\n</svg>\n", directives: [{ type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
2318
2484
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttLinksComponent, decorators: [{
2319
2485
  type: i0.Component,
2320
2486
  args: [{
@@ -2326,7 +2492,9 @@
2326
2492
  type: i0.Inject,
2327
2493
  args: [GANTT_UPPER_TOKEN]
2328
2494
  }] }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.ElementRef }, { type: GanttDragContainer }];
2329
- }, propDecorators: { flatData: [{
2495
+ }, propDecorators: { groups: [{
2496
+ type: i0.Input
2497
+ }], items: [{
2330
2498
  type: i0.Input
2331
2499
  }], lineClick: [{
2332
2500
  type: i0.Output
@@ -2355,11 +2523,10 @@
2355
2523
  }
2356
2524
  };
2357
2525
  GanttItemUpper.prototype.setPositions = function () {
2358
- var _a, _b, _c;
2359
2526
  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';
2527
+ itemElement.style.left = this.item.refs.x + 'px';
2528
+ itemElement.style.top = this.item.refs.y + 'px';
2529
+ itemElement.style.width = this.item.refs.width + 'px';
2363
2530
  if (this.item.type === exports.GanttItemType.bar) {
2364
2531
  itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2365
2532
  }
@@ -2409,7 +2576,7 @@
2409
2576
  return NgxGanttRangeComponent;
2410
2577
  }(GanttItemUpper));
2411
2578
  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"] }] });
2579
+ 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
2580
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttRangeComponent, decorators: [{
2414
2581
  type: i0.Component,
2415
2582
  args: [{
@@ -2497,6 +2664,8 @@
2497
2664
  var start = _this.ganttUpper.view.getDateByXPoint(x);
2498
2665
  var end = start.addDays(days);
2499
2666
  _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), end);
2667
+ _this.item.updateDate(start, end);
2668
+ _this.dragContainer.dragMoved.emit({ item: _this.item.origin });
2500
2669
  });
2501
2670
  dragRef.ended.subscribe(function (event) {
2502
2671
  var days = dateFns.differenceInCalendarDays(_this.item.end.value, _this.item.start.value);
@@ -2532,6 +2701,7 @@
2532
2701
  _this.barElement.style.width = width + 'px';
2533
2702
  _this.barElement.style.left = x + 'px';
2534
2703
  _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), _this.ganttUpper.view.getDateByXPoint(x + width));
2704
+ _this.item.updateDate(_this.ganttUpper.view.getDateByXPoint(x), _this.item.end);
2535
2705
  }
2536
2706
  }
2537
2707
  else {
@@ -2540,7 +2710,9 @@
2540
2710
  _this.barElement.style.width = width + 'px';
2541
2711
  _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x), _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + width));
2542
2712
  }
2713
+ _this.item.updateDate(_this.item.start, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + width));
2543
2714
  }
2715
+ _this.dragContainer.dragMoved.emit({ item: _this.item.origin });
2544
2716
  event.source.reset();
2545
2717
  });
2546
2718
  dragRef.ended.subscribe(function (event) {
@@ -2690,11 +2862,11 @@
2690
2862
  };
2691
2863
  return GanttBarDrag;
2692
2864
  }());
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 });
2865
+ 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
2866
  GanttBarDrag.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttBarDrag });
2695
2867
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttBarDrag, decorators: [{
2696
2868
  type: i0.Injectable
2697
- }], ctorParameters: function () { return [{ type: i1__namespace$1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }]; } });
2869
+ }], ctorParameters: function () { return [{ type: i1__namespace.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }]; } });
2698
2870
 
2699
2871
  function linearGradient(sideOrCorner, color, stop) {
2700
2872
  return "linear-gradient(" + sideOrCorner + "," + color + " 0%," + stop + " 40%)";
@@ -2765,7 +2937,7 @@
2765
2937
  return NgxGanttBarComponent;
2766
2938
  }(GanttItemUpper));
2767
2939
  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"] }] });
2940
+ 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
2941
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttBarComponent, decorators: [{
2770
2942
  type: i0.Component,
2771
2943
  args: [{
@@ -2796,13 +2968,13 @@
2796
2968
  this.ganttMainClass = true;
2797
2969
  }
2798
2970
  GanttMainComponent.prototype.ngOnInit = function () { };
2799
- GanttMainComponent.prototype.trackBy = function (item, index) {
2971
+ GanttMainComponent.prototype.trackBy = function (index, item) {
2800
2972
  return item.id || index;
2801
2973
  };
2802
2974
  return GanttMainComponent;
2803
2975
  }());
2804
2976
  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 } });
2977
+ 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;\">\n <div\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\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
2978
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttMainComponent, decorators: [{
2807
2979
  type: i0.Component,
2808
2980
  args: [{
@@ -2814,9 +2986,9 @@
2814
2986
  type: i0.Inject,
2815
2987
  args: [GANTT_UPPER_TOKEN]
2816
2988
  }] }];
2817
- }, propDecorators: { tempData: [{
2989
+ }, propDecorators: { groups: [{
2818
2990
  type: i0.Input
2819
- }], flatData: [{
2991
+ }], items: [{
2820
2992
  type: i0.Input
2821
2993
  }], groupHeaderTemplate: [{
2822
2994
  type: i0.Input
@@ -2835,62 +3007,23 @@
2835
3007
  args: ['class.gantt-main-container']
2836
3008
  }] } });
2837
3009
 
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
3010
  var NgxGanttComponent = /** @class */ (function (_super) {
2859
3011
  __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;
3012
+ function NgxGanttComponent(elementRef, cdr, ngZone, config) {
3013
+ var _this = _super.call(this, elementRef, cdr, ngZone, config) || this;
2865
3014
  _this.maxLevel = 2;
2866
3015
  _this.linkDragStarted = new i0.EventEmitter();
2867
3016
  _this.linkDragEnded = new i0.EventEmitter();
2868
3017
  _this.lineClick = new i0.EventEmitter();
2869
- _this.flatData = [];
2870
- _this.tempData = [];
3018
+ _this.selectedChange = new i0.EventEmitter();
2871
3019
  _this.ngUnsubscribe$ = new rxjs.Subject();
2872
- _this.dragContainer = dragContainer;
2873
- _this.computeAllRefs = false;
3020
+ _this.sideTableWidth = sideWidth;
2874
3021
  return _this;
2875
3022
  }
2876
3023
  NgxGanttComponent.prototype.ngOnInit = function () {
2877
3024
  var _this = this;
2878
3025
  _super.prototype.onInit.call(this);
2879
- this.buildVirtualFlatData();
2880
3026
  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
3027
  _this.dragContainer.linkDragStarted.pipe(operators.takeUntil(_this.ngUnsubscribe$)).subscribe(function (event) {
2895
3028
  _this.linkDragStarted.emit(event);
2896
3029
  });
@@ -2898,9 +3031,6 @@
2898
3031
  _this.linkDragEnded.emit(event);
2899
3032
  });
2900
3033
  });
2901
- this.view.start$.pipe(operators.skip(1), operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2902
- _this.computeTempDataRefs();
2903
- });
2904
3034
  };
2905
3035
  NgxGanttComponent.prototype.ngAfterViewInit = function () {
2906
3036
  var _this = this;
@@ -2912,40 +3042,9 @@
2912
3042
  });
2913
3043
  _this.cdr.detectChanges();
2914
3044
  });
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
3045
  };
2924
3046
  NgxGanttComponent.prototype.ngOnChanges = function (changes) {
2925
3047
  _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
3048
  };
2950
3049
  NgxGanttComponent.prototype.expandChildren = function (item) {
2951
3050
  var _this = this;
@@ -2956,7 +3055,6 @@
2956
3055
  this.childrenResolve(item.origin)
2957
3056
  .pipe(operators.take(1), operators.finalize(function () {
2958
3057
  item.loading = false;
2959
- _this.afterExpand();
2960
3058
  _this.expandChange.emit();
2961
3059
  _this.cdr.detectChanges();
2962
3060
  }))
@@ -2967,110 +3065,38 @@
2967
3065
  }
2968
3066
  else {
2969
3067
  this.computeItemsRefs.apply(this, __spreadArray([], __read(item.children)));
2970
- this.afterExpand();
2971
3068
  this.expandChange.emit();
2972
3069
  }
2973
3070
  }
2974
3071
  else {
2975
3072
  item.setExpand(false);
2976
- this.afterExpand();
2977
3073
  this.expandChange.emit();
2978
3074
  }
2979
3075
  };
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
- });
3076
+ NgxGanttComponent.prototype.selectItem = function (selectEvent) {
3077
+ var _a;
3078
+ if (!this.selectable) {
3079
+ return;
2990
3080
  }
2991
- if (this.items.length) {
2992
- virtualData.push.apply(virtualData, __spreadArray([], __read(recursiveItems(this.items, 0))));
3081
+ var event = selectEvent.event, selectedValue = selectEvent.selectedValue;
3082
+ this.selectionModel.toggle(selectedValue.id);
3083
+ var selectedIds = this.selectionModel.selected;
3084
+ if (this.multiple) {
3085
+ var selectedValue_1 = this.getGanttItems(selectedIds).map(function (item) { return item.origin; });
3086
+ this.selectedChange.emit({ event: event, selectedValue: selectedValue_1 });
2993
3087
  }
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;
3088
+ else {
3089
+ var selectedValue_2 = (_a = this.getGanttItem(selectedIds[0])) === null || _a === void 0 ? void 0 : _a.origin;
3090
+ this.selectedChange.emit({ event: event, selectedValue: selectedValue_2 });
3012
3091
  }
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
3092
  };
3065
3093
  NgxGanttComponent.prototype.ngOnDestroy = function () {
3066
3094
  _super.prototype.onDestroy.call(this);
3067
3095
  };
3068
3096
  return NgxGanttComponent;
3069
3097
  }(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 });
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,
3098
+ 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 });
3099
+ 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", selectedChange: "selectedChange" }, providers: [
3074
3100
  {
3075
3101
  provide: GANTT_UPPER_TOKEN,
3076
3102
  useExisting: NgxGanttComponent
@@ -3079,7 +3105,7 @@
3079
3105
  provide: GANTT_ABSTRACT_TOKEN,
3080
3106
  useExisting: i0.forwardRef(function () { return NgxGanttComponent; })
3081
3107
  }
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 });
3108
+ ], 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 (itemClick)=\"selectItem($event)\"\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"], outputs: ["itemClick"] }, { type: GanttMainComponent, selector: "gantt-main", inputs: ["groups", "items", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
3083
3109
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttComponent, decorators: [{
3084
3110
  type: i0.Component,
3085
3111
  args: [{
@@ -3087,8 +3113,6 @@
3087
3113
  templateUrl: './gantt.component.html',
3088
3114
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
3089
3115
  providers: [
3090
- GanttDomService,
3091
- GanttDragContainer,
3092
3116
  {
3093
3117
  provide: GANTT_UPPER_TOKEN,
3094
3118
  useExisting: NgxGanttComponent
@@ -3100,8 +3124,9 @@
3100
3124
  ]
3101
3125
  }]
3102
3126
  }], 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
3127
+ return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }, { type: undefined, decorators: [{
3128
+ type: i0.Inject,
3129
+ args: [GANTT_GLOBAL_CONFIG]
3105
3130
  }] }];
3106
3131
  }, propDecorators: { maxLevel: [{
3107
3132
  type: i0.Input
@@ -3117,6 +3142,8 @@
3117
3142
  type: i0.Output
3118
3143
  }], lineClick: [{
3119
3144
  type: i0.Output
3145
+ }], selectedChange: [{
3146
+ type: i0.Output
3120
3147
  }], table: [{
3121
3148
  type: i0.ContentChild,
3122
3149
  args: [NgxGanttTableComponent]
@@ -3126,128 +3153,6 @@
3126
3153
  }], tableEmptyTemplate: [{
3127
3154
  type: i0.ContentChild,
3128
3155
  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
3156
  }] } });
3252
3157
 
3253
3158
  var NgxGanttModule = /** @class */ (function () {
@@ -3259,11 +3164,9 @@
3259
3164
  NgxGanttModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, declarations: [NgxGanttComponent,
3260
3165
  NgxGanttTableComponent,
3261
3166
  NgxGanttTableColumnComponent,
3262
- GanttTableHeaderComponent,
3263
- GanttTableBodyComponent,
3167
+ GanttTableComponent,
3264
3168
  GanttMainComponent,
3265
- GanttCalendarHeaderComponent,
3266
- GanttCalendarGridComponent,
3169
+ GanttCalendarComponent,
3267
3170
  GanttLinksComponent,
3268
3171
  NgxGanttBarComponent,
3269
3172
  GanttIconComponent,
@@ -3272,17 +3175,22 @@
3272
3175
  NgxGanttRootComponent,
3273
3176
  IsGanttRangeItemPipe,
3274
3177
  IsGanttBarItemPipe,
3275
- IsGanttCustomItemPipe], imports: [i1.CommonModule, i1$1.DragDropModule, i6.ScrollingModule], exports: [NgxGanttComponent,
3178
+ IsGanttCustomItemPipe], imports: [i2.CommonModule, i1.DragDropModule], exports: [NgxGanttComponent,
3276
3179
  NgxGanttTableComponent,
3277
3180
  NgxGanttTableColumnComponent,
3278
3181
  NgxGanttRootComponent,
3279
3182
  NgxGanttBarComponent,
3280
3183
  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]] });
3184
+ NgxGanttModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, providers: [
3185
+ {
3186
+ provide: GANTT_GLOBAL_CONFIG,
3187
+ useValue: defaultConfig
3188
+ }
3189
+ ], imports: [[i2.CommonModule, i1.DragDropModule]] });
3282
3190
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, decorators: [{
3283
3191
  type: i0.NgModule,
3284
3192
  args: [{
3285
- imports: [i1.CommonModule, i1$1.DragDropModule, i6.ScrollingModule],
3193
+ imports: [i2.CommonModule, i1.DragDropModule],
3286
3194
  exports: [
3287
3195
  NgxGanttComponent,
3288
3196
  NgxGanttTableComponent,
@@ -3295,11 +3203,9 @@
3295
3203
  NgxGanttComponent,
3296
3204
  NgxGanttTableComponent,
3297
3205
  NgxGanttTableColumnComponent,
3298
- GanttTableHeaderComponent,
3299
- GanttTableBodyComponent,
3206
+ GanttTableComponent,
3300
3207
  GanttMainComponent,
3301
- GanttCalendarHeaderComponent,
3302
- GanttCalendarGridComponent,
3208
+ GanttCalendarComponent,
3303
3209
  GanttLinksComponent,
3304
3210
  NgxGanttBarComponent,
3305
3211
  GanttIconComponent,
@@ -3310,7 +3216,12 @@
3310
3216
  IsGanttBarItemPipe,
3311
3217
  IsGanttCustomItemPipe
3312
3218
  ],
3313
- providers: [i6.CdkVirtualScrollViewport]
3219
+ providers: [
3220
+ {
3221
+ provide: GANTT_GLOBAL_CONFIG,
3222
+ useValue: defaultConfig
3223
+ }
3224
+ ]
3314
3225
  }]
3315
3226
  }] });
3316
3227
 
@@ -3514,6 +3425,7 @@
3514
3425
  return dateFns.startOfYear;
3515
3426
  }
3516
3427
  });
3428
+ exports.GANTT_GLOBAL_CONFIG = GANTT_GLOBAL_CONFIG;
3517
3429
  exports.GANTT_UPPER_TOKEN = GANTT_UPPER_TOKEN;
3518
3430
  exports.GanttBarClickEvent = GanttBarClickEvent;
3519
3431
  exports.GanttDate = GanttDate;
@@ -3526,6 +3438,7 @@
3526
3438
  exports.GanttLinkDragEvent = GanttLinkDragEvent;
3527
3439
  exports.GanttLoadOnScrollEvent = GanttLoadOnScrollEvent;
3528
3440
  exports.GanttPrintService = GanttPrintService;
3441
+ exports.GanttSelectedEvent = GanttSelectedEvent;
3529
3442
  exports.GanttTableEvent = GanttTableEvent;
3530
3443
  exports.GanttUpper = GanttUpper;
3531
3444
  exports.GanttView = GanttView;
@@ -3539,6 +3452,7 @@
3539
3452
  exports.NgxGanttRootComponent = NgxGanttRootComponent;
3540
3453
  exports.NgxGanttTableColumnComponent = NgxGanttTableColumnComponent;
3541
3454
  exports.NgxGanttTableComponent = NgxGanttTableComponent;
3455
+ exports.defaultConfig = defaultConfig;
3542
3456
  exports.primaryDatePointTop = primaryDatePointTop;
3543
3457
  exports.secondaryDatePointTop = secondaryDatePointTop;
3544
3458