@worktile/gantt 12.1.0-next.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/bundles/worktile-gantt.umd.js +721 -928
  2. package/bundles/worktile-gantt.umd.js.map +1 -1
  3. package/class/item.d.ts +0 -1
  4. package/components/calendar/{grid/calendar-grid.component.d.ts → calendar.component.d.ts} +9 -7
  5. package/components/links/links.component.d.ts +3 -2
  6. package/components/main/gantt-main.component.d.ts +3 -3
  7. package/components/table/gantt-table.component.d.ts +36 -0
  8. package/esm2015/class/item.js +1 -1
  9. package/esm2015/components/calendar/calendar.component.js +86 -0
  10. package/esm2015/components/links/links.component.js +42 -19
  11. package/esm2015/components/main/gantt-main.component.js +4 -4
  12. package/esm2015/components/table/gantt-table.component.js +146 -0
  13. package/esm2015/gantt-dom.service.js +2 -5
  14. package/esm2015/gantt-item-upper.js +4 -5
  15. package/esm2015/gantt-print.service.js +2 -2
  16. package/esm2015/gantt-upper.js +46 -33
  17. package/esm2015/gantt.component.js +17 -172
  18. package/esm2015/gantt.config.js +13 -0
  19. package/esm2015/gantt.module.js +22 -18
  20. package/esm2015/public-api.js +2 -1
  21. package/esm2015/root.component.js +7 -8
  22. package/esm2015/utils/helpers.js +10 -9
  23. package/esm2015/views/day.js +2 -2
  24. package/esm2015/views/month.js +3 -3
  25. package/esm2015/views/quarter.js +3 -3
  26. package/esm2015/views/view.js +4 -2
  27. package/esm2015/views/week.js +3 -3
  28. package/esm2015/views/year.js +2 -2
  29. package/fesm2015/worktile-gantt.js +706 -896
  30. package/fesm2015/worktile-gantt.js.map +1 -1
  31. package/gantt-dom.service.d.ts +0 -1
  32. package/gantt-upper.d.ts +7 -3
  33. package/gantt.component.d.ts +5 -26
  34. package/gantt.config.d.ts +23 -0
  35. package/gantt.module.d.ts +13 -16
  36. package/main.bundle.scss +195 -234
  37. package/package.json +1 -1
  38. package/public-api.d.ts +1 -0
  39. package/utils/helpers.d.ts +3 -5
  40. package/views/view.d.ts +2 -0
  41. package/components/calendar/header/calendar-header.component.d.ts +0 -21
  42. package/components/table/body/gantt-table-body.component.d.ts +0 -24
  43. package/components/table/header/gantt-table-header.component.d.ts +0 -29
  44. package/esm2015/components/calendar/grid/calendar-grid.component.js +0 -76
  45. package/esm2015/components/calendar/header/calendar-header.component.js +0 -70
  46. package/esm2015/components/table/body/gantt-table-body.component.js +0 -68
  47. package/esm2015/components/table/header/gantt-table-header.component.js +0 -126
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('rxjs/operators'), require('rxjs'), require('date-fns'), require('@angular/cdk/coercion'), require('@angular/cdk/scrolling'), require('@angular/cdk/drag-drop'), require('html2canvas')) :
3
- typeof define === 'function' && define.amd ? define('@worktile/gantt', ['exports', '@angular/core', '@angular/common', 'rxjs/operators', 'rxjs', 'date-fns', '@angular/cdk/coercion', '@angular/cdk/scrolling', '@angular/cdk/drag-drop', 'html2canvas'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.worktile = global.worktile || {}, global.worktile.gantt = {}), global.ng.core, global.ng.common, global.rxjs.operators, global.rxjs, global.dateFns, global.ng.cdk.coercion, global.ng.cdk.scrolling, global.ng.cdk.dragDrop, global.html2canvas));
5
- }(this, (function (exports, i0, i1, operators, rxjs, dateFns, coercion, i6, i1$1, html2canvas) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('rxjs/operators'), require('rxjs'), require('date-fns'), require('@angular/cdk/coercion'), require('@angular/cdk/drag-drop'), require('html2canvas')) :
3
+ typeof define === 'function' && define.amd ? define('@worktile/gantt', ['exports', '@angular/core', '@angular/common', 'rxjs/operators', 'rxjs', 'date-fns', '@angular/cdk/coercion', '@angular/cdk/drag-drop', 'html2canvas'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.worktile = global.worktile || {}, global.worktile.gantt = {}), global.ng.core, global.ng.common, global.rxjs.operators, global.rxjs, global.dateFns, global.ng.cdk.coercion, global.ng.cdk.dragDrop, global.html2canvas));
5
+ }(this, (function (exports, i0, i2, operators, rxjs, dateFns, coercion, i1, html2canvas) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -27,9 +27,8 @@
27
27
  }
28
28
 
29
29
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
30
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
30
31
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
31
- var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
32
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
33
32
  var html2canvas__default = /*#__PURE__*/_interopDefaultLegacy(html2canvas);
34
33
 
35
34
  /*! *****************************************************************************
@@ -660,11 +659,24 @@
660
659
  return GanttGroupInternal;
661
660
  }());
662
661
 
662
+ var defaultConfig = {
663
+ dateFormat: {
664
+ week: '第w周',
665
+ month: 'M月',
666
+ quarter: 'QQQ',
667
+ year: 'yyyy年',
668
+ yearMonth: 'yyyy年MM月',
669
+ yearQuarter: 'yyyy年QQQ',
670
+ }
671
+ };
672
+ var GANTT_GLOBAL_CONFIG = new i0.InjectionToken('GANTT_GLOBAL_CONFIG');
673
+
663
674
  var primaryDatePointTop = 18;
664
675
  var secondaryDatePointTop = 36;
665
676
  var viewOptions$5 = {
666
677
  min: new GanttDate().addYears(-1).startOfYear(),
667
- max: new GanttDate().addYears(1).endOfYear()
678
+ max: new GanttDate().addYears(1).endOfYear(),
679
+ dateFormat: defaultConfig.dateFormat
668
680
  };
669
681
  var GanttView = /** @class */ (function () {
670
682
  function GanttView(start, end, options) {
@@ -817,7 +829,7 @@
817
829
  var points = [];
818
830
  for (var i = 0; i < quarters; i++) {
819
831
  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);
832
+ var point = new GanttDatePoint(start, start.format(this.options.dateFormat.yearQuarter), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
821
833
  points.push(point);
822
834
  }
823
835
  return points;
@@ -827,7 +839,7 @@
827
839
  var points = [];
828
840
  for (var i = 0; i < months.length; i++) {
829
841
  var start = new GanttDate(months[i]);
830
- var point = new GanttDatePoint(start, start.getMonth() + 1 + "\u6708", i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
842
+ var point = new GanttDatePoint(start, start.format(this.options.dateFormat.month), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
831
843
  points.push(point);
832
844
  }
833
845
  return points;
@@ -866,7 +878,7 @@
866
878
  var points = [];
867
879
  for (var i = 0; i < years.length; i++) {
868
880
  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);
881
+ var point = new GanttDatePoint(start, "" + start.format(this.options.dateFormat.year), (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
870
882
  points.push(point);
871
883
  }
872
884
  return points;
@@ -876,7 +888,7 @@
876
888
  var points = [];
877
889
  for (var i = 0; i <= quarters; i++) {
878
890
  var start = this.start.addQuarters(i);
879
- var point = new GanttDatePoint(start, start.format('QQQ'), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
891
+ var point = new GanttDatePoint(start, start.format(this.options.dateFormat.quarter), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
880
892
  points.push(point);
881
893
  }
882
894
  return points;
@@ -917,7 +929,7 @@
917
929
  for (var i = 0; i < weeks.length; i++) {
918
930
  var weekStart = new GanttDate(weeks[i]);
919
931
  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);
932
+ var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.yearMonth), (this.getCellWidth() * 7) / 2 + i * (this.getCellWidth() * 7), primaryDatePointTop);
921
933
  points.push(point);
922
934
  }
923
935
  return points;
@@ -968,7 +980,7 @@
968
980
  for (var i = 0; i < weeks.length; i++) {
969
981
  var weekStart = new GanttDate(weeks[i]);
970
982
  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);
983
+ var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.year), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
972
984
  points.push(point);
973
985
  }
974
986
  return points;
@@ -978,7 +990,7 @@
978
990
  var points = [];
979
991
  for (var i = 0; i < weeks.length; i++) {
980
992
  var start = new GanttDate(weeks[i]);
981
- var point = new GanttDatePoint(start, "\u7B2C" + start.format('w') + "\u5468", i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
993
+ var point = new GanttDatePoint(start, "" + start.format(this.options.dateFormat.week), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
982
994
  points.push(point);
983
995
  }
984
996
  return points;
@@ -1026,7 +1038,7 @@
1026
1038
  var pointTop = 27;
1027
1039
  for (var i = 0; i <= years; i++) {
1028
1040
  var start = this.start.addYears(i);
1029
- var point = new GanttDatePoint(start, start.format('yyyy') + "\u5E74", i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
1041
+ var point = new GanttDatePoint(start, "" + start.format(this.options.dateFormat.year), i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
1030
1042
  points.push(point);
1031
1043
  }
1032
1044
  return points;
@@ -1101,40 +1113,42 @@
1101
1113
  return pre.concat(Array.isArray(cur) ? flatten(cur) : cur);
1102
1114
  }, []);
1103
1115
  }
1104
- function recursiveItems(items, level) {
1116
+ function recursiveItems(items) {
1105
1117
  var result = [];
1106
1118
  (items || []).forEach(function (item) {
1107
- item.level = level;
1108
1119
  result.push(item);
1109
1120
  if (item.expanded && item.children) {
1110
- result.push.apply(result, __spreadArray([], __read(recursiveItems(item.children, level + 1))));
1121
+ result.push.apply(result, __spreadArray([], __read(recursiveItems(item.children))));
1111
1122
  }
1112
1123
  });
1113
1124
  return result;
1114
1125
  }
1115
- function keyBy(array, key) {
1116
- var result = {};
1117
- array.forEach(function (item) {
1118
- var keyValue = item[key];
1119
- result[keyValue] = item;
1126
+ function getFlatItems(items) {
1127
+ var result = [];
1128
+ (items || []).forEach(function (item) {
1129
+ result.push(item);
1130
+ if (item.children) {
1131
+ result.push.apply(result, __spreadArray([], __read(getFlatItems(item.children))));
1132
+ }
1120
1133
  });
1121
1134
  return result;
1122
1135
  }
1123
1136
 
1124
1137
  var GanttUpper = /** @class */ (function () {
1125
- function GanttUpper(elementRef, cdr, ngZone) {
1138
+ function GanttUpper(elementRef, cdr, ngZone, config) {
1126
1139
  this.elementRef = elementRef;
1127
1140
  this.cdr = cdr;
1128
1141
  this.ngZone = ngZone;
1142
+ this.config = config;
1129
1143
  this.originItems = [];
1130
1144
  this.originGroups = [];
1131
1145
  this.viewType = exports.GanttViewType.month;
1132
1146
  this.showTodayLine = true;
1147
+ this.viewOptions = {};
1133
1148
  this.loadOnScroll = new i0.EventEmitter();
1134
1149
  this.dragStarted = new i0.EventEmitter();
1135
1150
  this.dragEnded = new i0.EventEmitter();
1136
1151
  this.barClick = new i0.EventEmitter();
1137
- this.computeAllRefs = true;
1138
1152
  this.linkDragEnded = new i0.EventEmitter();
1139
1153
  this.items = [];
1140
1154
  this.groups = [];
@@ -1142,7 +1156,6 @@
1142
1156
  this.expandChange = new i0.EventEmitter();
1143
1157
  this.firstChange = true;
1144
1158
  this.unsubscribe$ = new rxjs.Subject();
1145
- this.expandedItemIds = [];
1146
1159
  this.ganttClass = true;
1147
1160
  }
1148
1161
  Object.defineProperty(GanttUpper.prototype, "element", {
@@ -1171,21 +1184,6 @@
1171
1184
  GanttUpper.prototype.setupItems = function () {
1172
1185
  var _this = this;
1173
1186
  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
1187
  this.items = [];
1190
1188
  if (this.groups.length > 0) {
1191
1189
  this.originItems.forEach(function (origin) {
@@ -1204,18 +1202,23 @@
1204
1202
  }
1205
1203
  };
1206
1204
  GanttUpper.prototype.setupExpandedState = function () {
1207
- var _this = this;
1205
+ this.originItems = uniqBy(this.originItems, 'id');
1208
1206
  var items = [];
1207
+ var flatOriginItems = getFlatItems(this.originItems);
1209
1208
  if (this.items.length > 0) {
1210
1209
  items = recursiveItems(this.items);
1211
1210
  }
1212
1211
  else {
1213
1212
  items = flatten(this.groups.map(function (group) { return recursiveItems(group.items); }));
1214
1213
  }
1215
- this.expandedItemIds = [];
1216
1214
  items.forEach(function (item) {
1217
1215
  if (item.origin.expanded) {
1218
- _this.expandedItemIds.push(item.id);
1216
+ var newItem = flatOriginItems.find(function (originItem) { return originItem.id === item.id; });
1217
+ if (newItem) {
1218
+ if (newItem.expanded === undefined) {
1219
+ newItem.expanded = true;
1220
+ }
1221
+ }
1219
1222
  }
1220
1223
  });
1221
1224
  };
@@ -1246,18 +1249,24 @@
1246
1249
  };
1247
1250
  GanttUpper.prototype.computeRefs = function () {
1248
1251
  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
- }
1252
+ this.groups.forEach(function (group) {
1253
+ var groupItems = recursiveItems(group.items);
1254
+ _this.computeItemsRefs.apply(_this, __spreadArray([], __read(groupItems)));
1255
+ });
1256
+ var items = recursiveItems(this.items);
1257
+ this.computeItemsRefs.apply(this, __spreadArray([], __read(items)));
1258
+ };
1259
+ GanttUpper.prototype.expandGroups = function (expanded) {
1260
+ this.groups.forEach(function (group) {
1261
+ group.setExpand(expanded);
1262
+ });
1263
+ this.expandChange.next();
1264
+ this.cdr.detectChanges();
1257
1265
  };
1258
1266
  GanttUpper.prototype.onInit = function () {
1259
1267
  var _this = this;
1260
1268
  this.styles = Object.assign({}, defaultStyles, this.styles);
1269
+ this.viewOptions.dateFormat = Object.assign({}, defaultConfig.dateFormat, this.config.dateFormat, this.viewOptions.dateFormat);
1261
1270
  this.createView();
1262
1271
  this.setupGroups();
1263
1272
  this.setupItems();
@@ -1319,13 +1328,30 @@
1319
1328
  GanttUpper.prototype.detectChanges = function () {
1320
1329
  this.cdr.detectChanges();
1321
1330
  };
1331
+ GanttUpper.prototype.expandGroup = function (group) {
1332
+ group.setExpand(!group.expanded);
1333
+ this.expandChange.emit();
1334
+ this.cdr.detectChanges();
1335
+ };
1336
+ // public functions
1337
+ GanttUpper.prototype.expandAll = function () {
1338
+ this.expandGroups(true);
1339
+ };
1340
+ GanttUpper.prototype.collapseAll = function () {
1341
+ this.expandGroups(false);
1342
+ };
1322
1343
  return GanttUpper;
1323
1344
  }());
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 });
1345
+ 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 });
1325
1346
  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 });
1326
1347
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttUpper, decorators: [{
1327
1348
  type: i0.Directive
1328
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }]; }, propDecorators: { originItems: [{
1349
+ }], ctorParameters: function () {
1350
+ return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }, { type: undefined, decorators: [{
1351
+ type: i0.Inject,
1352
+ args: [GANTT_GLOBAL_CONFIG]
1353
+ }] }];
1354
+ }, propDecorators: { originItems: [{
1329
1355
  type: i0.Input,
1330
1356
  args: ['items']
1331
1357
  }], originGroups: [{
@@ -1434,219 +1460,172 @@
1434
1460
  type: i0.Output
1435
1461
  }] } });
1436
1462
 
1437
- var scrollThreshold = 50;
1438
- var ScrollDirection;
1439
- (function (ScrollDirection) {
1440
- ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1441
- ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1442
- ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1443
- })(ScrollDirection || (ScrollDirection = {}));
1444
- var GanttDomService = /** @class */ (function () {
1445
- function GanttDomService() {
1446
- this.unsubscribe$ = new rxjs.Subject();
1447
- }
1448
- GanttDomService.prototype.monitorScrollChange = function () {
1449
- var _this = this;
1450
- rxjs.merge(rxjs.fromEvent(this.mainContainer, 'scroll'), rxjs.fromEvent(this.sideContainer, 'scroll'))
1451
- .pipe(operators.takeUntil(this.unsubscribe$))
1452
- .subscribe(function (event) {
1453
- _this.syncScroll(event);
1454
- });
1455
- rxjs.fromEvent(this.mainContainer, 'scroll')
1456
- .pipe(operators.startWith(), operators.takeUntil(this.unsubscribe$))
1457
- .subscribe(function (event) {
1458
- // if (this.mainContainer.scrollLeft > 0) {
1459
- // this.side.classList.add('gantt-side-has-shadow');
1460
- // } else {
1461
- // this.side.classList.remove('gantt-side-has-shadow');
1462
- // }
1463
- });
1464
- };
1465
- GanttDomService.prototype.syncScroll = function (event) {
1466
- var target = event.currentTarget;
1467
- this.calendarHeader.scrollLeft = this.mainContainer.scrollLeft;
1468
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1469
- this.sideContainer.scrollTop = target.scrollTop;
1470
- this.mainContainer.scrollTop = target.scrollTop;
1471
- };
1472
- GanttDomService.prototype.disableBrowserWheelEvent = function () {
1473
- var container = this.mainContainer;
1474
- rxjs.fromEvent(container, 'wheel')
1475
- .pipe(operators.takeUntil(this.unsubscribe$))
1476
- .subscribe(function (event) {
1477
- var delta = event.deltaX;
1478
- if (!delta) {
1479
- return;
1480
- }
1481
- if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1482
- (container.scrollLeft === 0 && delta < 0)) {
1483
- event.preventDefault();
1484
- }
1485
- });
1486
- };
1487
- GanttDomService.prototype.initialize = function (root) {
1488
- this.root = root.nativeElement;
1489
- this.side = this.root.getElementsByClassName('gantt-side')[0];
1490
- this.container = this.root.getElementsByClassName('gantt-container')[0];
1491
- this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
1492
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1493
- this.calendarHeader = this.root.getElementsByClassName('gantt-calendar-header')[0];
1494
- this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-grid')[0];
1495
- this.monitorScrollChange();
1496
- this.disableBrowserWheelEvent();
1497
- };
1498
- GanttDomService.prototype.getViewerScroll = function () {
1499
- var _this = this;
1500
- return rxjs.fromEvent(this.mainContainer, 'scroll').pipe(operators.map(function () { return _this.mainContainer.scrollLeft; }), operators.pairwise(), operators.map(function (_a) {
1501
- var _b = __read(_a, 2), previous = _b[0], current = _b[1];
1502
- var event = {
1503
- target: _this.mainContainer,
1504
- direction: ScrollDirection.NONE
1505
- };
1506
- if (current - previous < 0) {
1507
- if (_this.mainContainer.scrollLeft < scrollThreshold && _this.mainContainer.scrollLeft > 0) {
1508
- event.direction = ScrollDirection.LEFT;
1509
- }
1510
- }
1511
- if (current - previous > 0) {
1512
- if (_this.mainContainer.scrollWidth - _this.mainContainer.clientWidth - _this.mainContainer.scrollLeft < scrollThreshold) {
1513
- event.direction = ScrollDirection.RIGHT;
1514
- }
1515
- }
1516
- return event;
1517
- }));
1518
- };
1519
- GanttDomService.prototype.getResize = function () {
1520
- return rxjs.fromEvent(window, 'resize').pipe(operators.auditTime(150));
1521
- };
1522
- GanttDomService.prototype.scrollMainContainer = function (left) {
1523
- if (isNumber(left)) {
1524
- var scrollLeft = left - this.mainContainer.clientWidth / 2;
1525
- this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
1526
- this.calendarHeader.scrollLeft = this.mainContainer.scrollLeft;
1527
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1528
- }
1529
- };
1530
- GanttDomService.prototype.ngOnDestroy = function () {
1531
- this.unsubscribe$.next();
1532
- this.unsubscribe$.complete();
1533
- };
1534
- return GanttDomService;
1535
- }());
1536
- GanttDomService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1537
- GanttDomService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService });
1538
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService, decorators: [{
1539
- type: i0.Injectable
1540
- }], ctorParameters: function () { return []; } });
1541
-
1542
- var GanttDragContainer = /** @class */ (function () {
1543
- function GanttDragContainer() {
1544
- this.dragStarted = new i0.EventEmitter();
1545
- this.dragEnded = new i0.EventEmitter();
1546
- this.linkDragStarted = new i0.EventEmitter();
1547
- this.linkDragEntered = new i0.EventEmitter();
1548
- this.linkDragEnded = new i0.EventEmitter();
1549
- }
1550
- GanttDragContainer.prototype.emitLinkDragStarted = function (from, item) {
1551
- this.linkDraggingId = item.id;
1552
- this.linkDragFrom = from;
1553
- this.linkDragSource = this.linkDragFrom === 'source' ? item : null;
1554
- this.linkDragTarget = this.linkDragFrom === 'target' ? item : null;
1555
- this.linkDragStarted.emit({
1556
- source: this.linkDragSource && this.linkDragSource.origin,
1557
- target: this.linkDragTarget && this.linkDragTarget.origin
1558
- });
1559
- };
1560
- GanttDragContainer.prototype.emitLinkDragEntered = function (item) {
1561
- if (this.linkDragFrom === 'source') {
1562
- this.linkDragTarget = item;
1563
- }
1564
- else {
1565
- this.linkDragSource = item;
1566
- }
1567
- this.linkDragEntered.emit({
1568
- source: this.linkDragSource.origin,
1569
- target: this.linkDragTarget.origin
1570
- });
1571
- };
1572
- GanttDragContainer.prototype.emitLinkDragLeaved = function () {
1573
- if (this.linkDragFrom === 'source') {
1574
- this.linkDragTarget = null;
1575
- }
1576
- else {
1577
- this.linkDragSource = null;
1578
- }
1579
- };
1580
- GanttDragContainer.prototype.emitLinkDragEnded = function () {
1581
- this.linkDraggingId = null;
1582
- if (this.linkDragSource && this.linkDragTarget) {
1583
- this.linkDragSource.addLink(this.linkDragTarget.id);
1584
- this.linkDragEnded.emit({
1585
- source: this.linkDragSource.origin,
1586
- target: this.linkDragTarget.origin
1587
- });
1588
- }
1589
- this.linkDragSource = null;
1590
- this.linkDragTarget = null;
1591
- };
1592
- return GanttDragContainer;
1593
- }());
1594
- GanttDragContainer.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1595
- GanttDragContainer.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer });
1596
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer, decorators: [{
1597
- type: i0.Injectable
1598
- }], ctorParameters: function () { return []; } });
1599
-
1600
1463
  var GANTT_ABSTRACT_TOKEN = new i0.InjectionToken('gantt-abstract-token');
1601
1464
 
1602
- var defaultColumnWidth = 100;
1603
- var minColumnWidth = 80;
1604
- var GanttTableHeaderComponent = /** @class */ (function () {
1605
- function GanttTableHeaderComponent(elementRef, gantt) {
1465
+ 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>";
1466
+ 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>";
1467
+ 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>";
1468
+ 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>";
1469
+ 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>";
1470
+ 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>";
1471
+ var icons = {
1472
+ 'angle-right': angleRight,
1473
+ 'angle-down': angleDown,
1474
+ 'plus-square': plusSquare,
1475
+ 'minus-square': minusSquare,
1476
+ loading: loadingIcon,
1477
+ empty: emptyIcon
1478
+ };
1479
+
1480
+ var GanttIconComponent = /** @class */ (function () {
1481
+ function GanttIconComponent(elementRef) {
1606
1482
  this.elementRef = elementRef;
1607
- this.gantt = gantt;
1608
- this.tableWidth = 0;
1609
- this.className = "gantt-table-header gantt-table-row";
1483
+ this.isIcon = true;
1610
1484
  }
1611
- Object.defineProperty(GanttTableHeaderComponent.prototype, "columns", {
1612
- set: function (columns) {
1613
- columns.forEach(function (column) {
1614
- if (!column.columnWidth) {
1615
- column.columnWidth = coercion.coerceCssPixelValue(defaultColumnWidth);
1616
- }
1617
- });
1618
- this.columnList = columns;
1485
+ Object.defineProperty(GanttIconComponent.prototype, "iconName", {
1486
+ set: function (name) {
1487
+ this.setSvg(name);
1619
1488
  },
1620
1489
  enumerable: false,
1621
1490
  configurable: true
1622
1491
  });
1623
- GanttTableHeaderComponent.prototype.ngOnInit = function () { };
1624
- GanttTableHeaderComponent.prototype.ngAfterViewInit = function () {
1625
- this.tableWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
1626
- };
1627
- GanttTableHeaderComponent.prototype.dragFixed = function (config) {
1628
- if (config.movedWidth < config.minWidth) {
1629
- config.target.style.transform = "translate3d(" + (config.minWidth - config.originWidth) + "px, 0, 0)";
1630
- }
1631
- };
1632
- GanttTableHeaderComponent.prototype.dragStarted = function (event) {
1633
- var target = event.source.element.nativeElement;
1634
- this.dragStartLeft = target.getBoundingClientRect().left;
1635
- };
1636
- GanttTableHeaderComponent.prototype.dragMoved = function (event, column) {
1637
- var target = event.source.element.nativeElement;
1638
- var left = target.getBoundingClientRect().left;
1639
- var originWidth;
1640
- var movedWidth;
1641
- var minWidth;
1642
- if (column) {
1643
- originWidth = parseInt(column.columnWidth, 10);
1644
- movedWidth = originWidth + (left - this.dragStartLeft);
1645
- minWidth = minColumnWidth;
1492
+ GanttIconComponent.prototype.ngOnInit = function () { };
1493
+ GanttIconComponent.prototype.ngAfterViewInit = function () { };
1494
+ GanttIconComponent.prototype.setSvg = function (name) {
1495
+ var iconSvg = icons[name];
1496
+ if (iconSvg) {
1497
+ this.elementRef.nativeElement.innerHTML = iconSvg;
1646
1498
  }
1647
1499
  else {
1648
- originWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
1649
- movedWidth = originWidth + (left - this.dragStartLeft);
1500
+ this.elementRef.nativeElement.innerHTML = '';
1501
+ }
1502
+ };
1503
+ return GanttIconComponent;
1504
+ }());
1505
+ 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 });
1506
+ 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 });
1507
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttIconComponent, decorators: [{
1508
+ type: i0.Component,
1509
+ args: [{
1510
+ selector: 'gantt-icon',
1511
+ template: ''
1512
+ }]
1513
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { isIcon: [{
1514
+ type: i0.HostBinding,
1515
+ args: ['class.gantt-icon']
1516
+ }], iconName: [{
1517
+ type: i0.Input
1518
+ }] } });
1519
+
1520
+ var IsGanttRangeItemPipe = /** @class */ (function () {
1521
+ function IsGanttRangeItemPipe() {
1522
+ }
1523
+ IsGanttRangeItemPipe.prototype.transform = function (value) {
1524
+ return value === exports.GanttItemType.range;
1525
+ };
1526
+ return IsGanttRangeItemPipe;
1527
+ }());
1528
+ IsGanttRangeItemPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttRangeItemPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1529
+ IsGanttRangeItemPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1530
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttRangeItemPipe, decorators: [{
1531
+ type: i0.Pipe,
1532
+ args: [{
1533
+ name: 'isGanttRangeItem'
1534
+ }]
1535
+ }] });
1536
+ var IsGanttBarItemPipe = /** @class */ (function () {
1537
+ function IsGanttBarItemPipe() {
1538
+ }
1539
+ IsGanttBarItemPipe.prototype.transform = function (value) {
1540
+ return value === exports.GanttItemType.bar;
1541
+ };
1542
+ return IsGanttBarItemPipe;
1543
+ }());
1544
+ IsGanttBarItemPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttBarItemPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1545
+ IsGanttBarItemPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1546
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttBarItemPipe, decorators: [{
1547
+ type: i0.Pipe,
1548
+ args: [{
1549
+ name: 'isGanttBarItem'
1550
+ }]
1551
+ }] });
1552
+ var IsGanttCustomItemPipe = /** @class */ (function () {
1553
+ function IsGanttCustomItemPipe() {
1554
+ }
1555
+ IsGanttCustomItemPipe.prototype.transform = function (value) {
1556
+ return value === exports.GanttItemType.custom;
1557
+ };
1558
+ return IsGanttCustomItemPipe;
1559
+ }());
1560
+ IsGanttCustomItemPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttCustomItemPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
1561
+ IsGanttCustomItemPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1562
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: IsGanttCustomItemPipe, decorators: [{
1563
+ type: i0.Pipe,
1564
+ args: [{
1565
+ name: 'isGanttCustomItem'
1566
+ }]
1567
+ }] });
1568
+
1569
+ var defaultColumnWidth = 100;
1570
+ var minColumnWidth = 80;
1571
+ var GanttTableComponent = /** @class */ (function () {
1572
+ function GanttTableComponent(gantt, elementRef) {
1573
+ this.gantt = gantt;
1574
+ this.elementRef = elementRef;
1575
+ this.ganttTableClass = true;
1576
+ this.ganttTableEmptyClass = false;
1577
+ }
1578
+ Object.defineProperty(GanttTableComponent.prototype, "columns", {
1579
+ set: function (columns) {
1580
+ columns.forEach(function (column) {
1581
+ if (!column.columnWidth) {
1582
+ column.columnWidth = coercion.coerceCssPixelValue(defaultColumnWidth);
1583
+ }
1584
+ });
1585
+ this.columnList = columns;
1586
+ },
1587
+ enumerable: false,
1588
+ configurable: true
1589
+ });
1590
+ GanttTableComponent.prototype.ngOnInit = function () { };
1591
+ GanttTableComponent.prototype.ngOnChanges = function (changes) {
1592
+ var _a, _b;
1593
+ 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)) {
1594
+ this.ganttTableEmptyClass = true;
1595
+ }
1596
+ else {
1597
+ this.ganttTableEmptyClass = false;
1598
+ }
1599
+ };
1600
+ GanttTableComponent.prototype.dragFixed = function (config) {
1601
+ if (config.movedWidth < config.minWidth) {
1602
+ config.target.style.transform = "translate3d(" + (config.minWidth - config.originWidth) + "px, 0, 0)";
1603
+ }
1604
+ };
1605
+ GanttTableComponent.prototype.expandGroup = function (group) {
1606
+ this.gantt.expandGroup(group);
1607
+ };
1608
+ GanttTableComponent.prototype.expandChildren = function (item) {
1609
+ this.gantt.expandChildren(item);
1610
+ };
1611
+ GanttTableComponent.prototype.dragStarted = function (event) {
1612
+ var target = event.source.element.nativeElement;
1613
+ this.dragStartLeft = target.getBoundingClientRect().left;
1614
+ };
1615
+ GanttTableComponent.prototype.dragMoved = function (event, column) {
1616
+ var target = event.source.element.nativeElement;
1617
+ var left = target.getBoundingClientRect().left;
1618
+ var originWidth;
1619
+ var movedWidth;
1620
+ var minWidth;
1621
+ if (column) {
1622
+ originWidth = parseInt(column.columnWidth, 10);
1623
+ movedWidth = originWidth + (left - this.dragStartLeft);
1624
+ minWidth = minColumnWidth;
1625
+ }
1626
+ else {
1627
+ originWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
1628
+ movedWidth = originWidth + (left - this.dragStartLeft);
1650
1629
  minWidth = minColumnWidth * this.columnList.length;
1651
1630
  }
1652
1631
  this.dragFixed({
@@ -1657,8 +1636,7 @@
1657
1636
  });
1658
1637
  this.showAuxiliaryLine(event);
1659
1638
  };
1660
- GanttTableHeaderComponent.prototype.columnDragEnded = function (event, column) {
1661
- var beforeWidth = parseInt(column.columnWidth, 10);
1639
+ GanttTableComponent.prototype.columnDragEnded = function (event, column) {
1662
1640
  var target = event.source.element.nativeElement;
1663
1641
  var left = target.getBoundingClientRect().left;
1664
1642
  var width = parseInt(column.columnWidth, 10) + (left - this.dragStartLeft);
@@ -1667,150 +1645,317 @@
1667
1645
  if (this.gantt.table) {
1668
1646
  this.gantt.table.columnChanges.emit({ columns: this.columnList });
1669
1647
  }
1670
- this.tableWidth = this.tableWidth - beforeWidth + columnWidth;
1671
1648
  this.hideAuxiliaryLine();
1672
1649
  event.source.reset();
1673
1650
  };
1674
- GanttTableHeaderComponent.prototype.tableDragEnded = function (event) {
1651
+ GanttTableComponent.prototype.tableDragEnded = function (event) {
1675
1652
  var target = event.source.element.nativeElement;
1676
1653
  var left = target.getBoundingClientRect().left;
1677
1654
  var tableWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
1678
1655
  var dragWidth = left - this.dragStartLeft;
1679
- var tempWidth = 0;
1680
1656
  this.columnList.forEach(function (column) {
1681
1657
  var lastColumnWidth = parseInt(column.columnWidth, 10);
1682
1658
  var distributeWidth = parseInt(String(dragWidth * (lastColumnWidth / tableWidth)), 10);
1683
1659
  var columnWidth = Math.max(lastColumnWidth + distributeWidth || 0, minColumnWidth);
1684
1660
  column.columnWidth = coercion.coerceCssPixelValue(columnWidth);
1685
- tempWidth += columnWidth;
1686
1661
  });
1687
- this.tableWidth = tempWidth;
1688
1662
  if (this.gantt.table) {
1689
1663
  this.gantt.table.columnChanges.emit({ columns: this.columnList });
1690
1664
  }
1691
1665
  this.hideAuxiliaryLine();
1692
1666
  event.source.reset();
1693
1667
  };
1694
- GanttTableHeaderComponent.prototype.showAuxiliaryLine = function (event) {
1668
+ GanttTableComponent.prototype.showAuxiliaryLine = function (event) {
1695
1669
  var tableRect = this.elementRef.nativeElement.getBoundingClientRect();
1696
1670
  var targetRect = event.source.element.nativeElement.getBoundingClientRect();
1697
1671
  var distance = { x: targetRect.left - tableRect.left, y: targetRect.top - tableRect.top };
1698
1672
  this.draglineElementRef.nativeElement.style.left = distance.x + "px";
1699
1673
  this.draglineElementRef.nativeElement.style.display = 'block';
1700
1674
  };
1701
- GanttTableHeaderComponent.prototype.hideAuxiliaryLine = function () {
1675
+ GanttTableComponent.prototype.hideAuxiliaryLine = function () {
1702
1676
  this.draglineElementRef.nativeElement.style.display = 'none';
1703
1677
  };
1704
- return GanttTableHeaderComponent;
1678
+ return GanttTableComponent;
1705
1679
  }());
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: [{
1680
+ GanttTableComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttTableComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1681
+ GanttTableComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttTableComponent, selector: "gantt-table", inputs: { groups: "groups", items: "items", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate" }, host: { properties: { "class.gantt-table": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass" } }, viewQueries: [{ propertyName: "draglineElementRef", first: true, predicate: ["dragLine"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"gantt-table-header gantt-table-row\">\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let i = index\" [style.width]=\"column.columnWidth\">\n <ng-container *ngIf=\"column.headerTemplateRef; else default\" [ngTemplateOutlet]=\"column.headerTemplateRef\"></ng-container>\n <ng-template #default>\n {{ column.name }}\n </ng-template>\n <div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event, column)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"columnDragEnded($event, column)\"\n ></div>\n </div>\n</div>\n<div class=\"gantt-table-body\">\n <ng-container *ngIf=\"!groups.length && !items.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"groups && groups.length > 0; else itemsTemplate\">\n <ng-container *ngFor=\"let group of groups\">\n <div class=\"gantt-table-group\" [ngClass]=\"group.class\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"group.expanded\" (click)=\"expandGroup(group)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"group.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.origin, group: group.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ group.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <ng-container *ngIf=\"group.expanded\">\n <ng-template\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ group: group, items: group.items, level: 0 }\"\n ></ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"tableDragEnded($event)\"\n></div>\n\n<div #dragLine class=\"gantt-table-drag-auxiliary-line\"></div>\n\n<ng-template #itemsTemplate>\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items, level: 0 }\"></ng-template>\n</ng-template>\n\n<ng-template #ganttItems let-group=\"group\" let-items=\"items\" let-level=\"level\">\n <ng-container *ngFor=\"let item of items\">\n <div\n class=\"gantt-table-item gantt-table-row\"\n [class.gantt-table-item-first-level-group]=\"level === 0 && (item.type | isGanttRangeItem)\"\n [class.gantt-table-item-with-group]=\"group\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n >\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let first = first\" [style.width]=\"column.columnWidth\">\n <div *ngIf=\"first\" class=\"gantt-expand-icon\" [style.marginLeft.px]=\"level * 20\">\n <ng-container *ngIf=\"level < gantt.maxLevel - 1 && item.expandable\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren(item)\"\n ></gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children, level: level + 1, group: group }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n", components: [{ type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }], directives: [{ type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1__namespace.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragDisabled", "cdkDragStartDelay", "cdkDragLockAxis", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragBoundary", "cdkDragRootElement", "cdkDragData", "cdkDragFreeDragPosition"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i2__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "isGanttRangeItem": IsGanttRangeItemPipe } });
1682
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttTableComponent, decorators: [{
1709
1683
  type: i0.Component,
1710
1684
  args: [{
1711
- selector: 'gantt-table-header',
1712
- templateUrl: './gantt-table-header.component.html'
1685
+ selector: 'gantt-table',
1686
+ templateUrl: './gantt-table.component.html'
1713
1687
  }]
1714
1688
  }], ctorParameters: function () {
1715
- return [{ type: i0__namespace.ElementRef }, { type: undefined, decorators: [{
1689
+ return [{ type: undefined, decorators: [{
1716
1690
  type: i0.Inject,
1717
1691
  args: [GANTT_ABSTRACT_TOKEN]
1718
- }] }];
1719
- }, propDecorators: { columns: [{
1692
+ }] }, { type: i0__namespace.ElementRef }];
1693
+ }, propDecorators: { groups: [{
1694
+ type: i0.Input
1695
+ }], items: [{
1696
+ type: i0.Input
1697
+ }], columns: [{
1698
+ type: i0.Input
1699
+ }], groupTemplate: [{
1700
+ type: i0.Input
1701
+ }], emptyTemplate: [{
1720
1702
  type: i0.Input
1721
1703
  }], draglineElementRef: [{
1722
1704
  type: i0.ViewChild,
1723
1705
  args: ['dragLine', { static: true }]
1724
- }], className: [{
1706
+ }], ganttTableClass: [{
1707
+ type: i0.HostBinding,
1708
+ args: ['class.gantt-table']
1709
+ }], ganttTableEmptyClass: [{
1725
1710
  type: i0.HostBinding,
1726
- args: ['class']
1711
+ args: ['class.gantt-table-empty']
1727
1712
  }] } });
1728
1713
 
1729
- var GanttPrintService = /** @class */ (function () {
1730
- function GanttPrintService() {
1714
+ var scrollThreshold = 50;
1715
+ var ScrollDirection;
1716
+ (function (ScrollDirection) {
1717
+ ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1718
+ ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1719
+ ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1720
+ })(ScrollDirection || (ScrollDirection = {}));
1721
+ var GanttDomService = /** @class */ (function () {
1722
+ function GanttDomService() {
1723
+ this.unsubscribe$ = new rxjs.Subject();
1731
1724
  }
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
- }
1725
+ GanttDomService.prototype.monitorScrollChange = function () {
1726
+ var _this = this;
1727
+ rxjs.merge(rxjs.fromEvent(this.mainContainer, 'scroll'), rxjs.fromEvent(this.sideContainer, 'scroll'))
1728
+ .pipe(operators.takeUntil(this.unsubscribe$))
1729
+ .subscribe(function (event) {
1730
+ _this.syncScroll(event);
1731
+ });
1732
+ rxjs.fromEvent(this.mainContainer, 'scroll')
1733
+ .pipe(operators.startWith(), operators.takeUntil(this.unsubscribe$))
1734
+ .subscribe(function (event) {
1735
+ // if (this.mainContainer.scrollLeft > 0) {
1736
+ // this.side.classList.add('gantt-side-has-shadow');
1737
+ // } else {
1738
+ // this.side.classList.remove('gantt-side-has-shadow');
1739
+ // }
1740
+ });
1748
1741
  };
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);
1742
+ GanttDomService.prototype.syncScroll = function (event) {
1743
+ var target = event.currentTarget;
1744
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1745
+ this.sideContainer.scrollTop = target.scrollTop;
1746
+ this.mainContainer.scrollTop = target.scrollTop;
1747
+ };
1748
+ GanttDomService.prototype.disableBrowserWheelEvent = function () {
1749
+ var container = this.mainContainer;
1750
+ rxjs.fromEvent(container, 'wheel')
1751
+ .pipe(operators.takeUntil(this.unsubscribe$))
1752
+ .subscribe(function (event) {
1753
+ var delta = event.deltaX;
1754
+ if (!delta) {
1755
+ return;
1783
1756
  }
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);
1757
+ if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1758
+ (container.scrollLeft === 0 && delta < 0)) {
1759
+ event.preventDefault();
1789
1760
  }
1790
- finally { if (e_3) throw e_3.error; }
1791
- }
1761
+ });
1792
1762
  };
1793
- GanttPrintService.prototype.register = function (root) {
1763
+ GanttDomService.prototype.initialize = function (root) {
1794
1764
  this.root = root.nativeElement;
1765
+ this.side = this.root.getElementsByClassName('gantt-side')[0];
1766
+ this.container = this.root.getElementsByClassName('gantt-container')[0];
1767
+ this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
1795
1768
  this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1769
+ this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-overlay')[0];
1770
+ this.monitorScrollChange();
1771
+ this.disableBrowserWheelEvent();
1796
1772
  };
1797
- GanttPrintService.prototype.print = function (name, ignoreElementClass) {
1773
+ GanttDomService.prototype.getViewerScroll = function () {
1798
1774
  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)) {
1775
+ return rxjs.fromEvent(this.mainContainer, 'scroll').pipe(operators.map(function () { return _this.mainContainer.scrollLeft; }), operators.pairwise(), operators.map(function (_a) {
1776
+ var _b = __read(_a, 2), previous = _b[0], current = _b[1];
1777
+ var event = {
1778
+ target: _this.mainContainer,
1779
+ direction: ScrollDirection.NONE
1780
+ };
1781
+ if (current - previous < 0) {
1782
+ if (_this.mainContainer.scrollLeft < scrollThreshold && _this.mainContainer.scrollLeft > 0) {
1783
+ event.direction = ScrollDirection.LEFT;
1784
+ }
1785
+ }
1786
+ if (current - previous > 0) {
1787
+ if (_this.mainContainer.scrollWidth - _this.mainContainer.clientWidth - _this.mainContainer.scrollLeft < scrollThreshold) {
1788
+ event.direction = ScrollDirection.RIGHT;
1789
+ }
1790
+ }
1791
+ return event;
1792
+ }));
1793
+ };
1794
+ GanttDomService.prototype.getResize = function () {
1795
+ return rxjs.fromEvent(window, 'resize').pipe(operators.auditTime(150));
1796
+ };
1797
+ GanttDomService.prototype.scrollMainContainer = function (left) {
1798
+ if (isNumber(left)) {
1799
+ var scrollLeft = left - this.mainContainer.clientWidth / 2;
1800
+ this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
1801
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1802
+ }
1803
+ };
1804
+ GanttDomService.prototype.ngOnDestroy = function () {
1805
+ this.unsubscribe$.next();
1806
+ this.unsubscribe$.complete();
1807
+ };
1808
+ return GanttDomService;
1809
+ }());
1810
+ GanttDomService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1811
+ GanttDomService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService });
1812
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDomService, decorators: [{
1813
+ type: i0.Injectable
1814
+ }], ctorParameters: function () { return []; } });
1815
+
1816
+ var GanttDragContainer = /** @class */ (function () {
1817
+ function GanttDragContainer() {
1818
+ this.dragStarted = new i0.EventEmitter();
1819
+ this.dragEnded = new i0.EventEmitter();
1820
+ this.linkDragStarted = new i0.EventEmitter();
1821
+ this.linkDragEntered = new i0.EventEmitter();
1822
+ this.linkDragEnded = new i0.EventEmitter();
1823
+ }
1824
+ GanttDragContainer.prototype.emitLinkDragStarted = function (from, item) {
1825
+ this.linkDraggingId = item.id;
1826
+ this.linkDragFrom = from;
1827
+ this.linkDragSource = this.linkDragFrom === 'source' ? item : null;
1828
+ this.linkDragTarget = this.linkDragFrom === 'target' ? item : null;
1829
+ this.linkDragStarted.emit({
1830
+ source: this.linkDragSource && this.linkDragSource.origin,
1831
+ target: this.linkDragTarget && this.linkDragTarget.origin
1832
+ });
1833
+ };
1834
+ GanttDragContainer.prototype.emitLinkDragEntered = function (item) {
1835
+ if (this.linkDragFrom === 'source') {
1836
+ this.linkDragTarget = item;
1837
+ }
1838
+ else {
1839
+ this.linkDragSource = item;
1840
+ }
1841
+ this.linkDragEntered.emit({
1842
+ source: this.linkDragSource.origin,
1843
+ target: this.linkDragTarget.origin
1844
+ });
1845
+ };
1846
+ GanttDragContainer.prototype.emitLinkDragLeaved = function () {
1847
+ if (this.linkDragFrom === 'source') {
1848
+ this.linkDragTarget = null;
1849
+ }
1850
+ else {
1851
+ this.linkDragSource = null;
1852
+ }
1853
+ };
1854
+ GanttDragContainer.prototype.emitLinkDragEnded = function () {
1855
+ this.linkDraggingId = null;
1856
+ if (this.linkDragSource && this.linkDragTarget) {
1857
+ this.linkDragSource.addLink(this.linkDragTarget.id);
1858
+ this.linkDragEnded.emit({
1859
+ source: this.linkDragSource.origin,
1860
+ target: this.linkDragTarget.origin
1861
+ });
1862
+ }
1863
+ this.linkDragSource = null;
1864
+ this.linkDragTarget = null;
1865
+ };
1866
+ return GanttDragContainer;
1867
+ }());
1868
+ GanttDragContainer.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1869
+ GanttDragContainer.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer });
1870
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragContainer, decorators: [{
1871
+ type: i0.Injectable
1872
+ }], ctorParameters: function () { return []; } });
1873
+
1874
+ var GanttPrintService = /** @class */ (function () {
1875
+ function GanttPrintService() {
1876
+ }
1877
+ GanttPrintService.prototype.setInlineStyles = function (targetElem) {
1878
+ var e_1, _a;
1879
+ var svgElements = Array.from(targetElem.getElementsByTagName('svg'));
1880
+ try {
1881
+ for (var svgElements_1 = __values(svgElements), svgElements_1_1 = svgElements_1.next(); !svgElements_1_1.done; svgElements_1_1 = svgElements_1.next()) {
1882
+ var svgElement = svgElements_1_1.value;
1883
+ this.recursElementChildren(svgElement);
1884
+ }
1885
+ }
1886
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1887
+ finally {
1888
+ try {
1889
+ if (svgElements_1_1 && !svgElements_1_1.done && (_a = svgElements_1.return)) _a.call(svgElements_1);
1890
+ }
1891
+ finally { if (e_1) throw e_1.error; }
1892
+ }
1893
+ };
1894
+ GanttPrintService.prototype.recursElementChildren = function (node) {
1895
+ var e_2, _a, e_3, _b;
1896
+ var transformProperties = [
1897
+ 'fill',
1898
+ 'color',
1899
+ 'font-size',
1900
+ 'stroke',
1901
+ 'font',
1902
+ 'text-anchor',
1903
+ 'stroke-dasharray',
1904
+ 'shape-rendering',
1905
+ 'stroke-width'
1906
+ ];
1907
+ if (!node.style) {
1908
+ return;
1909
+ }
1910
+ var styles = getComputedStyle(node);
1911
+ try {
1912
+ for (var transformProperties_1 = __values(transformProperties), transformProperties_1_1 = transformProperties_1.next(); !transformProperties_1_1.done; transformProperties_1_1 = transformProperties_1.next()) {
1913
+ var transformProperty = transformProperties_1_1.value;
1914
+ node.style[transformProperty] = styles[transformProperty];
1915
+ }
1916
+ }
1917
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1918
+ finally {
1919
+ try {
1920
+ if (transformProperties_1_1 && !transformProperties_1_1.done && (_a = transformProperties_1.return)) _a.call(transformProperties_1);
1921
+ }
1922
+ finally { if (e_2) throw e_2.error; }
1923
+ }
1924
+ try {
1925
+ for (var _c = __values(Array.from(node.childNodes)), _d = _c.next(); !_d.done; _d = _c.next()) {
1926
+ var child = _d.value;
1927
+ this.recursElementChildren(child);
1928
+ }
1929
+ }
1930
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1931
+ finally {
1932
+ try {
1933
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
1934
+ }
1935
+ finally { if (e_3) throw e_3.error; }
1936
+ }
1937
+ };
1938
+ GanttPrintService.prototype.register = function (root) {
1939
+ this.root = root.nativeElement;
1940
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1941
+ };
1942
+ GanttPrintService.prototype.print = function (name, ignoreElementClass) {
1943
+ var _this = this;
1944
+ if (name === void 0) { name = 'download'; }
1945
+ var root = this.root;
1946
+ var mainContainer = this.mainContainer;
1947
+ // set print width
1948
+ var printWidth = root.offsetWidth;
1949
+ // set print height
1950
+ var printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
1951
+ html2canvas__default['default'](root, {
1952
+ logging: false,
1953
+ allowTaint: true,
1954
+ useCORS: true,
1955
+ width: printWidth,
1956
+ height: printHeight,
1957
+ ignoreElements: function (element) {
1958
+ if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
1814
1959
  return true;
1815
1960
  }
1816
1961
  if (element.classList.contains('gantt-calendar-today-overlay')) {
@@ -1821,7 +1966,7 @@
1821
1966
  var ganttClass = root.className;
1822
1967
  var cloneGanttDom = cloneDocument.querySelector("." + ganttClass.replace(/\s+/g, '.'));
1823
1968
  var cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
1824
- var cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-grid-main');
1969
+ var cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
1825
1970
  var cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
1826
1971
  // change targetDom width
1827
1972
  cloneGanttDom.style.width = printWidth + "px";
@@ -1853,62 +1998,78 @@
1853
1998
  type: i0.Injectable
1854
1999
  }], ctorParameters: function () { return []; } });
1855
2000
 
1856
- var GanttCalendarHeaderComponent = /** @class */ (function () {
1857
- function GanttCalendarHeaderComponent(ganttUpper, ngZone, elementRef) {
2001
+ var mainHeight = 5000;
2002
+ var GanttCalendarComponent = /** @class */ (function () {
2003
+ function GanttCalendarComponent(ganttUpper, ngZone, elementRef) {
1858
2004
  this.ganttUpper = ganttUpper;
1859
2005
  this.ngZone = ngZone;
1860
2006
  this.elementRef = elementRef;
1861
2007
  this.unsubscribe$ = new rxjs.Subject();
1862
2008
  this.headerHeight = headerHeight;
2009
+ this.mainHeight = mainHeight;
2010
+ this.todayHeight = todayHeight;
2011
+ this.todayWidth = todayWidth;
2012
+ this.todayBorderRadius = todayBorderRadius;
1863
2013
  this.viewTypes = exports.GanttViewType;
1864
- this.className = "gantt-calendar gantt-calendar-header";
2014
+ this.className = true;
1865
2015
  }
1866
- Object.defineProperty(GanttCalendarHeaderComponent.prototype, "view", {
2016
+ Object.defineProperty(GanttCalendarComponent.prototype, "view", {
1867
2017
  get: function () {
1868
2018
  return this.ganttUpper.view;
1869
2019
  },
1870
2020
  enumerable: false,
1871
2021
  configurable: true
1872
2022
  });
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 () {
2023
+ GanttCalendarComponent.prototype.setTodayPoint = function () {
1885
2024
  var x = this.view.getTodayXPoint();
1886
2025
  var today = new GanttDate().getDate();
1887
2026
  var todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
1888
2027
  var rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
2028
+ var line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
1889
2029
  if (isNumber(x)) {
1890
2030
  if (rect) {
1891
2031
  rect.style.left = x - todayWidth / 2 + "px";
1892
2032
  rect.style.top = headerHeight - todayHeight + "px";
1893
2033
  rect.innerHTML = today.toString();
1894
2034
  }
2035
+ if (line) {
2036
+ line.style.left = x + "px";
2037
+ line.style.top = headerHeight + "px";
2038
+ line.style.bottom = -mainHeight + "px";
2039
+ }
1895
2040
  }
1896
2041
  else {
1897
2042
  todayEle.style.display = 'none';
1898
2043
  }
1899
2044
  };
1900
- GanttCalendarHeaderComponent.prototype.trackBy = function (point, index) {
2045
+ GanttCalendarComponent.prototype.ngOnInit = function () {
2046
+ var _this = this;
2047
+ this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
2048
+ rxjs.merge(_this.ganttUpper.viewChange, _this.ganttUpper.view.start$)
2049
+ .pipe(operators.takeUntil(_this.unsubscribe$))
2050
+ .subscribe(function () {
2051
+ _this.setTodayPoint();
2052
+ });
2053
+ });
2054
+ };
2055
+ GanttCalendarComponent.prototype.ngAfterViewInit = function () { };
2056
+ GanttCalendarComponent.prototype.ngOnChanges = function (changes) { };
2057
+ GanttCalendarComponent.prototype.trackBy = function (point, index) {
1901
2058
  return point.text || index;
1902
2059
  };
1903
- return GanttCalendarHeaderComponent;
2060
+ GanttCalendarComponent.prototype.ngOnDestroy = function () {
2061
+ this.unsubscribe$.next();
2062
+ this.unsubscribe$.complete();
2063
+ };
2064
+ return GanttCalendarComponent;
1904
2065
  }());
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: [{
2066
+ 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 });
2067
+ 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"] }] });
2068
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttCalendarComponent, decorators: [{
1908
2069
  type: i0.Component,
1909
2070
  args: [{
1910
- selector: 'gantt-calendar-header',
1911
- templateUrl: './calendar-header.component.html'
2071
+ selector: 'gantt-calendar-overlay',
2072
+ templateUrl: './calendar.component.html'
1912
2073
  }]
1913
2074
  }], ctorParameters: function () {
1914
2075
  return [{ type: GanttUpper, decorators: [{
@@ -1917,256 +2078,146 @@
1917
2078
  }] }, { type: i0__namespace.NgZone }, { type: i0__namespace.ElementRef }];
1918
2079
  }, propDecorators: { className: [{
1919
2080
  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
2081
+ args: ['class.gantt-calendar-overlay']
1976
2082
  }] } });
1977
2083
 
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;
2084
+ var GanttDragBackdropComponent = /** @class */ (function () {
2085
+ function GanttDragBackdropComponent() {
2086
+ this.backdropClass = true;
2032
2087
  }
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;
2088
+ GanttDragBackdropComponent.prototype.ngOnInit = function () { };
2089
+ return GanttDragBackdropComponent;
2068
2090
  }());
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: [{
2091
+ GanttDragBackdropComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragBackdropComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
2092
+ 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" });
2093
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttDragBackdropComponent, decorators: [{
2072
2094
  type: i0.Component,
2073
2095
  args: [{
2074
- selector: 'gantt-table-body',
2075
- templateUrl: './gantt-table-body.component.html'
2096
+ selector: 'gantt-drag-backdrop',
2097
+ templateUrl: "./drag-backdrop.component.html"
2076
2098
  }]
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: [{
2099
+ }], ctorParameters: function () { return []; }, propDecorators: { backdropClass: [{
2094
2100
  type: i0.HostBinding,
2095
- args: ['class.gantt-table-empty']
2101
+ args: ['class.gantt-drag-backdrop']
2096
2102
  }] } });
2097
2103
 
2098
- var mainHeight = 5000;
2099
- var GanttCalendarGridComponent = /** @class */ (function () {
2100
- function GanttCalendarGridComponent(ganttUpper, ngZone, elementRef) {
2101
- this.ganttUpper = ganttUpper;
2102
- this.ngZone = ngZone;
2104
+ var NgxGanttRootComponent = /** @class */ (function () {
2105
+ function NgxGanttRootComponent(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
2103
2106
  this.elementRef = elementRef;
2107
+ this.ngZone = ngZone;
2108
+ this.dom = dom;
2109
+ this.dragContainer = dragContainer;
2110
+ this.ganttUpper = ganttUpper;
2111
+ this.printService = printService;
2112
+ this.ganttClass = true;
2104
2113
  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";
2114
+ this.ganttUpper.dragContainer = dragContainer;
2110
2115
  }
2111
- Object.defineProperty(GanttCalendarGridComponent.prototype, "view", {
2116
+ Object.defineProperty(NgxGanttRootComponent.prototype, "view", {
2112
2117
  get: function () {
2113
2118
  return this.ganttUpper.view;
2114
2119
  },
2115
2120
  enumerable: false,
2116
2121
  configurable: true
2117
2122
  });
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";
2123
+ NgxGanttRootComponent.prototype.ngOnInit = function () {
2124
+ var _this = this;
2125
+ this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
2126
+ _this.dom.initialize(_this.elementRef);
2127
+ if (_this.printService) {
2128
+ _this.printService.register(_this.elementRef);
2127
2129
  }
2130
+ _this.setupScrollClass();
2131
+ _this.setupResize();
2132
+ _this.setupViewScroll();
2133
+ // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2134
+ _this.elementRef.nativeElement.style.opacity = '1';
2135
+ _this.ganttUpper.viewChange.pipe(operators.startWith(null)).subscribe(function () {
2136
+ _this.scrollToToday();
2137
+ });
2138
+ });
2139
+ };
2140
+ NgxGanttRootComponent.prototype.setupViewScroll = function () {
2141
+ var _this = this;
2142
+ if (this.ganttUpper.disabledLoadOnScroll) {
2143
+ return;
2128
2144
  }
2129
- else {
2130
- todayEle.style.display = 'none';
2131
- }
2145
+ this.dom
2146
+ .getViewerScroll()
2147
+ .pipe(operators.takeUntil(this.unsubscribe$))
2148
+ .subscribe(function (event) {
2149
+ if (event.direction === ScrollDirection.LEFT) {
2150
+ var dates_1 = _this.view.addStartDate();
2151
+ if (dates_1) {
2152
+ event.target.scrollLeft += _this.view.getDateRangeWidth(dates_1.start, dates_1.end);
2153
+ _this.ngZone.run(function () {
2154
+ _this.ganttUpper.loadOnScroll.emit({ start: dates_1.start.getUnixTime(), end: dates_1.end.getUnixTime() });
2155
+ });
2156
+ }
2157
+ }
2158
+ if (event.direction === ScrollDirection.RIGHT) {
2159
+ var dates_2 = _this.view.addEndDate();
2160
+ if (dates_2) {
2161
+ _this.ngZone.run(function () {
2162
+ _this.ganttUpper.loadOnScroll.emit({ start: dates_2.start.getUnixTime(), end: dates_2.end.getUnixTime() });
2163
+ });
2164
+ }
2165
+ }
2166
+ });
2132
2167
  };
2133
- GanttCalendarGridComponent.prototype.ngOnInit = function () {
2168
+ NgxGanttRootComponent.prototype.setupResize = function () {
2134
2169
  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
- });
2170
+ this.dom
2171
+ .getResize()
2172
+ .pipe(operators.takeUntil(this.unsubscribe$))
2173
+ .subscribe(function () {
2174
+ _this.setupScrollClass();
2141
2175
  });
2142
2176
  };
2143
- GanttCalendarGridComponent.prototype.ngAfterViewInit = function () { };
2144
- GanttCalendarGridComponent.prototype.ngOnChanges = function (changes) { };
2145
- GanttCalendarGridComponent.prototype.trackBy = function (point, index) {
2146
- return point.text || index;
2177
+ NgxGanttRootComponent.prototype.setupScrollClass = function () {
2178
+ var mainContainer = this.dom.mainContainer;
2179
+ var height = mainContainer.offsetHeight;
2180
+ var scrollHeight = mainContainer.scrollHeight;
2181
+ if (scrollHeight > height) {
2182
+ this.elementRef.nativeElement.className = 'gantt gantt-scroll';
2183
+ }
2184
+ else {
2185
+ this.elementRef.nativeElement.className = 'gantt';
2186
+ }
2147
2187
  };
2148
- GanttCalendarGridComponent.prototype.ngOnDestroy = function () {
2149
- this.unsubscribe$.next();
2150
- this.unsubscribe$.complete();
2188
+ NgxGanttRootComponent.prototype.scrollToToday = function () {
2189
+ var x = this.view.getTodayXPoint();
2190
+ this.dom.scrollMainContainer(x);
2151
2191
  };
2152
- return GanttCalendarGridComponent;
2192
+ return NgxGanttRootComponent;
2153
2193
  }());
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: [{
2194
+ 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 });
2195
+ 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"] }] });
2196
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttRootComponent, decorators: [{
2157
2197
  type: i0.Component,
2158
2198
  args: [{
2159
- selector: 'gantt-calendar-grid',
2160
- templateUrl: './calendar-grid.component.html'
2199
+ selector: 'ngx-gantt-root',
2200
+ templateUrl: './root.component.html',
2201
+ providers: [GanttDomService, GanttDragContainer]
2161
2202
  }]
2162
2203
  }], ctorParameters: function () {
2163
- return [{ type: GanttUpper, decorators: [{
2204
+ return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
2164
2205
  type: i0.Inject,
2165
2206
  args: [GANTT_UPPER_TOKEN]
2166
- }] }, { type: i0__namespace.NgZone }, { type: i0__namespace.ElementRef }];
2167
- }, propDecorators: { className: [{
2207
+ }] }, { type: GanttPrintService, decorators: [{
2208
+ type: i0.Optional
2209
+ }] }];
2210
+ }, propDecorators: { sideWidth: [{
2211
+ type: i0.Input
2212
+ }], ganttClass: [{
2168
2213
  type: i0.HostBinding,
2169
- args: ['class']
2214
+ args: ['class.gantt']
2215
+ }], sideTemplate: [{
2216
+ type: i0.ContentChild,
2217
+ args: ['sideTemplate', { static: true }]
2218
+ }], mainTemplate: [{
2219
+ type: i0.ContentChild,
2220
+ args: ['mainTemplate', { static: true }]
2170
2221
  }] } });
2171
2222
 
2172
2223
  var LinkColors;
@@ -2181,7 +2232,8 @@
2181
2232
  this.cdr = cdr;
2182
2233
  this.elementRef = elementRef;
2183
2234
  this.ganttDragContainer = ganttDragContainer;
2184
- this.flatData = [];
2235
+ this.groups = [];
2236
+ this.items = [];
2185
2237
  this.lineClick = new i0.EventEmitter();
2186
2238
  this.links = [];
2187
2239
  this.linkItems = [];
@@ -2192,8 +2244,8 @@
2192
2244
  }
2193
2245
  GanttLinksComponent.prototype.ngOnInit = function () {
2194
2246
  var _this = this;
2195
- this.firstChange = false;
2196
2247
  this.buildLinks();
2248
+ this.firstChange = false;
2197
2249
  this.ganttDragContainer.dragStarted.pipe(operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2198
2250
  _this.elementRef.nativeElement.style.visibility = 'hidden';
2199
2251
  });
@@ -2215,21 +2267,40 @@
2215
2267
  var lineHeight = this.ganttUpper.styles.lineHeight;
2216
2268
  var barHeight = this.ganttUpper.styles.barHeight;
2217
2269
  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
- } }));
2270
+ if (this.groups.length > 0) {
2271
+ var itemNum_1 = 0;
2272
+ var groupNum_1 = 0;
2273
+ this.groups.forEach(function (group) {
2274
+ groupNum_1++;
2275
+ if (group.expanded) {
2276
+ var items = recursiveItems(group.items);
2277
+ items.forEach(function (item, itemIndex) {
2278
+ var y = (groupNum_1 + itemNum_1 + itemIndex) * lineHeight + item.refs.y + barHeight / 2;
2279
+ _this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
2280
+ x: item.refs.x,
2281
+ y: y
2282
+ }, after: {
2283
+ x: item.refs.x + item.refs.width,
2284
+ y: y
2285
+ } }));
2286
+ });
2287
+ itemNum_1 += items.length;
2230
2288
  }
2231
- }
2232
- });
2289
+ });
2290
+ }
2291
+ else {
2292
+ var items = recursiveItems(this.items);
2293
+ items.forEach(function (item, itemIndex) {
2294
+ var y = itemIndex * lineHeight + item.refs.y + barHeight / 2;
2295
+ _this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
2296
+ x: item.refs.x,
2297
+ y: y
2298
+ }, after: {
2299
+ x: item.refs.x + item.refs.width,
2300
+ y: y
2301
+ } }));
2302
+ });
2303
+ }
2233
2304
  };
2234
2305
  GanttLinksComponent.prototype.generatePath = function (source, target) {
2235
2306
  if (source.before && source.after && target.before && target.after) {
@@ -2314,7 +2385,7 @@
2314
2385
  return GanttLinksComponent;
2315
2386
  }());
2316
2387
  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"] }] });
2388
+ 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
2389
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttLinksComponent, decorators: [{
2319
2390
  type: i0.Component,
2320
2391
  args: [{
@@ -2326,7 +2397,9 @@
2326
2397
  type: i0.Inject,
2327
2398
  args: [GANTT_UPPER_TOKEN]
2328
2399
  }] }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.ElementRef }, { type: GanttDragContainer }];
2329
- }, propDecorators: { flatData: [{
2400
+ }, propDecorators: { groups: [{
2401
+ type: i0.Input
2402
+ }], items: [{
2330
2403
  type: i0.Input
2331
2404
  }], lineClick: [{
2332
2405
  type: i0.Output
@@ -2355,11 +2428,10 @@
2355
2428
  }
2356
2429
  };
2357
2430
  GanttItemUpper.prototype.setPositions = function () {
2358
- var _a, _b, _c;
2359
2431
  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';
2432
+ itemElement.style.left = this.item.refs.x + 'px';
2433
+ itemElement.style.top = this.item.refs.y + 'px';
2434
+ itemElement.style.width = this.item.refs.width + 'px';
2363
2435
  if (this.item.type === exports.GanttItemType.bar) {
2364
2436
  itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2365
2437
  }
@@ -2409,7 +2481,7 @@
2409
2481
  return NgxGanttRangeComponent;
2410
2482
  }(GanttItemUpper));
2411
2483
  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"] }] });
2484
+ 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
2485
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttRangeComponent, decorators: [{
2414
2486
  type: i0.Component,
2415
2487
  args: [{
@@ -2690,11 +2762,11 @@
2690
2762
  };
2691
2763
  return GanttBarDrag;
2692
2764
  }());
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 });
2765
+ 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
2766
  GanttBarDrag.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttBarDrag });
2695
2767
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttBarDrag, decorators: [{
2696
2768
  type: i0.Injectable
2697
- }], ctorParameters: function () { return [{ type: i1__namespace$1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }]; } });
2769
+ }], ctorParameters: function () { return [{ type: i1__namespace.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }]; } });
2698
2770
 
2699
2771
  function linearGradient(sideOrCorner, color, stop) {
2700
2772
  return "linear-gradient(" + sideOrCorner + "," + color + " 0%," + stop + " 40%)";
@@ -2765,7 +2837,7 @@
2765
2837
  return NgxGanttBarComponent;
2766
2838
  }(GanttItemUpper));
2767
2839
  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"] }] });
2840
+ 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
2841
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttBarComponent, decorators: [{
2770
2842
  type: i0.Component,
2771
2843
  args: [{
@@ -2802,7 +2874,7 @@
2802
2874
  return GanttMainComponent;
2803
2875
  }());
2804
2876
  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 } });
2877
+ GanttMainComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttMainComponent, selector: "gantt-main", inputs: { groups: "groups", items: "items", groupHeaderTemplate: "groupHeaderTemplate", itemTemplate: "itemTemplate", barTemplate: "barTemplate", rangeTemplate: "rangeTemplate" }, outputs: { barClick: "barClick", lineClick: "lineClick" }, host: { properties: { "class.gantt-main-container": "this.ganttMainClass" } }, ngImport: i0__namespace, template: "<gantt-links-overlay [groups]=\"groups\" [items]=\"items\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<!-- groups -->\n<div class=\"gantt-main-groups\" *ngIf=\"groups && groups.length > 0; else itemsTemplate\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"group.class\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: group }\"></ng-template>\n </div>\n <div *ngIf=\"group.expanded\" class=\"gantt-items\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: group.items }\"></ng-template>\n </div>\n </ng-container>\n</div>\n<!-- items -->\n<ng-template #itemsTemplate>\n <div class=\"gantt-main-items\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items }\"></ng-template>\n </div>\n</ng-template>\n\n<ng-template #ganttItems let-items=\"items\">\n <ng-container *ngFor=\"let item of items; trackBy: trackBy\">\n <div class=\"gantt-item\" [style.height.px]=\"ganttUpper.styles.lineHeight\">\n <ng-container *ngIf=\"item.type | isGanttCustomItem\">\n <ng-template [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n </ng-container>\n <gantt-range *ngIf=\"item.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"item\"></gantt-range>\n <gantt-bar *ngIf=\"item.type | isGanttBarItem\" [item]=\"item\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n", components: [{ type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: ["groups", "items"], outputs: ["lineClick"] }, { type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range" }, { type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: ["barClick"] }], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "isGanttCustomItem": IsGanttCustomItemPipe, "isGanttRangeItem": IsGanttRangeItemPipe, "isGanttBarItem": IsGanttBarItemPipe } });
2806
2878
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttMainComponent, decorators: [{
2807
2879
  type: i0.Component,
2808
2880
  args: [{
@@ -2814,9 +2886,9 @@
2814
2886
  type: i0.Inject,
2815
2887
  args: [GANTT_UPPER_TOKEN]
2816
2888
  }] }];
2817
- }, propDecorators: { tempData: [{
2889
+ }, propDecorators: { groups: [{
2818
2890
  type: i0.Input
2819
- }], flatData: [{
2891
+ }], items: [{
2820
2892
  type: i0.Input
2821
2893
  }], groupHeaderTemplate: [{
2822
2894
  type: i0.Input
@@ -2835,62 +2907,22 @@
2835
2907
  args: ['class.gantt-main-container']
2836
2908
  }] } });
2837
2909
 
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
2910
  var NgxGanttComponent = /** @class */ (function (_super) {
2859
2911
  __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;
2912
+ function NgxGanttComponent(elementRef, cdr, ngZone, config) {
2913
+ var _this = _super.call(this, elementRef, cdr, ngZone, config) || this;
2865
2914
  _this.maxLevel = 2;
2866
2915
  _this.linkDragStarted = new i0.EventEmitter();
2867
2916
  _this.linkDragEnded = new i0.EventEmitter();
2868
2917
  _this.lineClick = new i0.EventEmitter();
2869
- _this.flatData = [];
2870
- _this.tempData = [];
2871
2918
  _this.ngUnsubscribe$ = new rxjs.Subject();
2872
- _this.dragContainer = dragContainer;
2873
- _this.computeAllRefs = false;
2919
+ _this.sideTableWidth = sideWidth;
2874
2920
  return _this;
2875
2921
  }
2876
2922
  NgxGanttComponent.prototype.ngOnInit = function () {
2877
2923
  var _this = this;
2878
2924
  _super.prototype.onInit.call(this);
2879
- this.buildVirtualFlatData();
2880
2925
  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
2926
  _this.dragContainer.linkDragStarted.pipe(operators.takeUntil(_this.ngUnsubscribe$)).subscribe(function (event) {
2895
2927
  _this.linkDragStarted.emit(event);
2896
2928
  });
@@ -2898,9 +2930,6 @@
2898
2930
  _this.linkDragEnded.emit(event);
2899
2931
  });
2900
2932
  });
2901
- this.view.start$.pipe(operators.skip(1), operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2902
- _this.computeTempDataRefs();
2903
- });
2904
2933
  };
2905
2934
  NgxGanttComponent.prototype.ngAfterViewInit = function () {
2906
2935
  var _this = this;
@@ -2912,40 +2941,9 @@
2912
2941
  });
2913
2942
  _this.cdr.detectChanges();
2914
2943
  });
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
2944
  };
2924
2945
  NgxGanttComponent.prototype.ngOnChanges = function (changes) {
2925
2946
  _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
2947
  };
2950
2948
  NgxGanttComponent.prototype.expandChildren = function (item) {
2951
2949
  var _this = this;
@@ -2956,7 +2954,6 @@
2956
2954
  this.childrenResolve(item.origin)
2957
2955
  .pipe(operators.take(1), operators.finalize(function () {
2958
2956
  item.loading = false;
2959
- _this.afterExpand();
2960
2957
  _this.expandChange.emit();
2961
2958
  _this.cdr.detectChanges();
2962
2959
  }))
@@ -2967,110 +2964,21 @@
2967
2964
  }
2968
2965
  else {
2969
2966
  this.computeItemsRefs.apply(this, __spreadArray([], __read(item.children)));
2970
- this.afterExpand();
2971
2967
  this.expandChange.emit();
2972
2968
  }
2973
2969
  }
2974
2970
  else {
2975
2971
  item.setExpand(false);
2976
- this.afterExpand();
2977
2972
  this.expandChange.emit();
2978
2973
  }
2979
2974
  };
2980
- NgxGanttComponent.prototype.buildVirtualFlatData = function () {
2981
- var virtualData = [];
2982
- if (this.groups.length) {
2983
- this.groups.forEach(function (group) {
2984
- virtualData.push(group);
2985
- if (group.expanded) {
2986
- var items = recursiveItems(group.items, 0);
2987
- virtualData.push.apply(virtualData, __spreadArray([], __read(items)));
2988
- }
2989
- });
2990
- }
2991
- if (this.items.length) {
2992
- virtualData.push.apply(virtualData, __spreadArray([], __read(recursiveItems(this.items, 0))));
2993
- }
2994
- this.flatData = __spreadArray([], __read(virtualData));
2995
- this.flatDataMap = keyBy(this.flatData, 'id');
2996
- };
2997
- NgxGanttComponent.prototype.afterExpand = function () {
2998
- this.buildVirtualFlatData();
2999
- this.tempData = this.flatData.slice(this.rangeStart, this.rangeEnd);
3000
- };
3001
- NgxGanttComponent.prototype.trackBy = function (item, index) {
3002
- return item.id || index;
3003
- };
3004
- NgxGanttComponent.prototype.scrollToToday = function () {
3005
- var x = this.view.getTodayXPoint();
3006
- this.dom.scrollMainContainer(x);
3007
- };
3008
- NgxGanttComponent.prototype.setupViewScroll = function () {
3009
- var _this = this;
3010
- if (this.disabledLoadOnScroll) {
3011
- return;
3012
- }
3013
- this.dom
3014
- .getViewerScroll()
3015
- .pipe(operators.takeUntil(this.unsubscribe$))
3016
- .subscribe(function (event) {
3017
- if (event.direction === ScrollDirection.LEFT) {
3018
- var dates_1 = _this.view.addStartDate();
3019
- if (dates_1) {
3020
- event.target.scrollLeft += _this.view.getDateRangeWidth(dates_1.start, dates_1.end);
3021
- _this.ngZone.run(function () {
3022
- _this.loadOnScroll.emit({ start: dates_1.start.getUnixTime(), end: dates_1.end.getUnixTime() });
3023
- });
3024
- }
3025
- }
3026
- if (event.direction === ScrollDirection.RIGHT) {
3027
- var dates_2 = _this.view.addEndDate();
3028
- if (dates_2) {
3029
- _this.ngZone.run(function () {
3030
- _this.loadOnScroll.emit({ start: dates_2.start.getUnixTime(), end: dates_2.end.getUnixTime() });
3031
- });
3032
- }
3033
- }
3034
- _this.cdr.detectChanges();
3035
- });
3036
- };
3037
- NgxGanttComponent.prototype.expandGroups = function (expanded) {
3038
- this.groups.forEach(function (group) {
3039
- group.setExpand(expanded);
3040
- });
3041
- this.afterExpand();
3042
- this.expandChange.next();
3043
- this.cdr.detectChanges();
3044
- };
3045
- NgxGanttComponent.prototype.computeTempDataRefs = function () {
3046
- var _this = this;
3047
- var tempItemData = [];
3048
- this.tempData.forEach(function (data) {
3049
- if (!data.hasOwnProperty('items')) {
3050
- var item = data;
3051
- if (item.links) {
3052
- item.links.forEach(function (link) {
3053
- if (_this.flatDataMap[link]) {
3054
- tempItemData.push(_this.flatDataMap[link]);
3055
- }
3056
- });
3057
- }
3058
- tempItemData.push(data);
3059
- }
3060
- });
3061
- this.computeItemsRefs.apply(this, __spreadArray([], __read(uniqBy(tempItemData, 'id'))));
3062
- this.flatData = __spreadArray([], __read(this.flatData));
3063
- this.tempData = __spreadArray([], __read(this.tempData));
3064
- };
3065
2975
  NgxGanttComponent.prototype.ngOnDestroy = function () {
3066
2976
  _super.prototype.onDestroy.call(this);
3067
2977
  };
3068
2978
  return NgxGanttComponent;
3069
2979
  }(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 });
2980
+ NgxGanttComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0__namespace.ɵɵFactoryTarget.Component });
3071
2981
  NgxGanttComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick" }, providers: [
3072
- GanttDomService,
3073
- GanttDragContainer,
3074
2982
  {
3075
2983
  provide: GANTT_UPPER_TOKEN,
3076
2984
  useExisting: NgxGanttComponent
@@ -3079,7 +2987,7 @@
3079
2987
  provide: GANTT_ABSTRACT_TOKEN,
3080
2988
  useExisting: i0.forwardRef(function () { return NgxGanttComponent; })
3081
2989
  }
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 });
2990
+ ], queries: [{ propertyName: "table", first: true, predicate: NgxGanttTableComponent, descendants: true }, { propertyName: "tableEmptyTemplate", first: true, predicate: ["tableEmpty"], descendants: true, static: true }, { propertyName: "columns", predicate: NgxGanttTableColumnComponent, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<ngx-gantt-root>\n <ng-template #sideTemplate>\n <gantt-table [groups]=\"groups\" [items]=\"items\" [columns]=\"columns\" [groupTemplate]=\"groupTemplate\" [emptyTemplate]=\"tableEmptyTemplate\"></gantt-table>\n </ng-template>\n <ng-template #mainTemplate>\n <gantt-main\n [groups]=\"groups\"\n [items]=\"items\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </ng-template>\n</ngx-gantt-root>\n", components: [{ type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }, { type: GanttTableComponent, selector: "gantt-table", inputs: ["groups", "items", "columns", "groupTemplate", "emptyTemplate"] }, { type: GanttMainComponent, selector: "gantt-main", inputs: ["groups", "items", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
3083
2991
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttComponent, decorators: [{
3084
2992
  type: i0.Component,
3085
2993
  args: [{
@@ -3087,8 +2995,6 @@
3087
2995
  templateUrl: './gantt.component.html',
3088
2996
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
3089
2997
  providers: [
3090
- GanttDomService,
3091
- GanttDragContainer,
3092
2998
  {
3093
2999
  provide: GANTT_UPPER_TOKEN,
3094
3000
  useExisting: NgxGanttComponent
@@ -3100,8 +3006,9 @@
3100
3006
  ]
3101
3007
  }]
3102
3008
  }], 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
3009
+ return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }, { type: undefined, decorators: [{
3010
+ type: i0.Inject,
3011
+ args: [GANTT_GLOBAL_CONFIG]
3105
3012
  }] }];
3106
3013
  }, propDecorators: { maxLevel: [{
3107
3014
  type: i0.Input
@@ -3126,128 +3033,6 @@
3126
3033
  }], tableEmptyTemplate: [{
3127
3034
  type: i0.ContentChild,
3128
3035
  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
3036
  }] } });
3252
3037
 
3253
3038
  var NgxGanttModule = /** @class */ (function () {
@@ -3259,11 +3044,9 @@
3259
3044
  NgxGanttModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, declarations: [NgxGanttComponent,
3260
3045
  NgxGanttTableComponent,
3261
3046
  NgxGanttTableColumnComponent,
3262
- GanttTableHeaderComponent,
3263
- GanttTableBodyComponent,
3047
+ GanttTableComponent,
3264
3048
  GanttMainComponent,
3265
- GanttCalendarHeaderComponent,
3266
- GanttCalendarGridComponent,
3049
+ GanttCalendarComponent,
3267
3050
  GanttLinksComponent,
3268
3051
  NgxGanttBarComponent,
3269
3052
  GanttIconComponent,
@@ -3272,17 +3055,22 @@
3272
3055
  NgxGanttRootComponent,
3273
3056
  IsGanttRangeItemPipe,
3274
3057
  IsGanttBarItemPipe,
3275
- IsGanttCustomItemPipe], imports: [i1.CommonModule, i1$1.DragDropModule, i6.ScrollingModule], exports: [NgxGanttComponent,
3058
+ IsGanttCustomItemPipe], imports: [i2.CommonModule, i1.DragDropModule], exports: [NgxGanttComponent,
3276
3059
  NgxGanttTableComponent,
3277
3060
  NgxGanttTableColumnComponent,
3278
3061
  NgxGanttRootComponent,
3279
3062
  NgxGanttBarComponent,
3280
3063
  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]] });
3064
+ NgxGanttModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, providers: [
3065
+ {
3066
+ provide: GANTT_GLOBAL_CONFIG,
3067
+ useValue: defaultConfig
3068
+ }
3069
+ ], imports: [[i2.CommonModule, i1.DragDropModule]] });
3282
3070
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, decorators: [{
3283
3071
  type: i0.NgModule,
3284
3072
  args: [{
3285
- imports: [i1.CommonModule, i1$1.DragDropModule, i6.ScrollingModule],
3073
+ imports: [i2.CommonModule, i1.DragDropModule],
3286
3074
  exports: [
3287
3075
  NgxGanttComponent,
3288
3076
  NgxGanttTableComponent,
@@ -3295,11 +3083,9 @@
3295
3083
  NgxGanttComponent,
3296
3084
  NgxGanttTableComponent,
3297
3085
  NgxGanttTableColumnComponent,
3298
- GanttTableHeaderComponent,
3299
- GanttTableBodyComponent,
3086
+ GanttTableComponent,
3300
3087
  GanttMainComponent,
3301
- GanttCalendarHeaderComponent,
3302
- GanttCalendarGridComponent,
3088
+ GanttCalendarComponent,
3303
3089
  GanttLinksComponent,
3304
3090
  NgxGanttBarComponent,
3305
3091
  GanttIconComponent,
@@ -3310,7 +3096,12 @@
3310
3096
  IsGanttBarItemPipe,
3311
3097
  IsGanttCustomItemPipe
3312
3098
  ],
3313
- providers: [i6.CdkVirtualScrollViewport]
3099
+ providers: [
3100
+ {
3101
+ provide: GANTT_GLOBAL_CONFIG,
3102
+ useValue: defaultConfig
3103
+ }
3104
+ ]
3314
3105
  }]
3315
3106
  }] });
3316
3107
 
@@ -3514,6 +3305,7 @@
3514
3305
  return dateFns.startOfYear;
3515
3306
  }
3516
3307
  });
3308
+ exports.GANTT_GLOBAL_CONFIG = GANTT_GLOBAL_CONFIG;
3517
3309
  exports.GANTT_UPPER_TOKEN = GANTT_UPPER_TOKEN;
3518
3310
  exports.GanttBarClickEvent = GanttBarClickEvent;
3519
3311
  exports.GanttDate = GanttDate;
@@ -3539,6 +3331,7 @@
3539
3331
  exports.NgxGanttRootComponent = NgxGanttRootComponent;
3540
3332
  exports.NgxGanttTableColumnComponent = NgxGanttTableColumnComponent;
3541
3333
  exports.NgxGanttTableComponent = NgxGanttTableComponent;
3334
+ exports.defaultConfig = defaultConfig;
3542
3335
  exports.primaryDatePointTop = primaryDatePointTop;
3543
3336
  exports.secondaryDatePointTop = secondaryDatePointTop;
3544
3337