@worktile/gantt 12.0.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 (63) hide show
  1. package/bundles/worktile-gantt.umd.js +1293 -1080
  2. package/bundles/worktile-gantt.umd.js.map +1 -1
  3. package/components/bar/bar-drag.d.ts +3 -0
  4. package/components/bar/bar.component.d.ts +3 -0
  5. package/components/calendar/calendar.component.d.ts +4 -1
  6. package/components/drag-backdrop/drag-backdrop.component.d.ts +3 -0
  7. package/components/icon/icon.component.d.ts +3 -0
  8. package/components/links/links.component.d.ts +3 -0
  9. package/components/main/gantt-main.component.d.ts +3 -0
  10. package/components/range/range.component.d.ts +3 -0
  11. package/components/table/gantt-table.component.d.ts +8 -3
  12. package/esm2015/components/bar/bar-drag.js +10 -12
  13. package/esm2015/components/bar/bar.component.js +29 -22
  14. package/esm2015/components/calendar/calendar.component.js +21 -17
  15. package/esm2015/components/drag-backdrop/drag-backdrop.component.js +14 -11
  16. package/esm2015/components/icon/icon.component.js +17 -15
  17. package/esm2015/components/links/links.component.js +28 -22
  18. package/esm2015/components/main/gantt-main.component.js +40 -22
  19. package/esm2015/components/range/range.component.js +21 -16
  20. package/esm2015/components/table/gantt-table.component.js +44 -23
  21. package/esm2015/gantt-abstract.js +3 -0
  22. package/esm2015/gantt-dom.service.js +7 -5
  23. package/esm2015/gantt-drag-container.js +7 -5
  24. package/esm2015/gantt-item-upper.js +17 -14
  25. package/esm2015/gantt-print.service.js +7 -5
  26. package/esm2015/gantt-upper.js +74 -44
  27. package/esm2015/gantt.component.js +66 -36
  28. package/esm2015/gantt.config.js +13 -0
  29. package/esm2015/gantt.module.js +67 -25
  30. package/esm2015/gantt.pipe.js +26 -16
  31. package/esm2015/public-api.js +4 -1
  32. package/esm2015/root.component.js +37 -25
  33. package/esm2015/table/gantt-column.component.js +26 -17
  34. package/esm2015/table/gantt-table.component.js +13 -11
  35. package/esm2015/utils/helpers.js +11 -1
  36. package/esm2015/views/day.js +2 -2
  37. package/esm2015/views/month.js +3 -3
  38. package/esm2015/views/quarter.js +3 -3
  39. package/esm2015/views/view.js +4 -2
  40. package/esm2015/views/week.js +3 -3
  41. package/esm2015/views/year.js +2 -2
  42. package/esm2015/worktile-gantt.js +1 -12
  43. package/fesm2015/worktile-gantt.js +1380 -1199
  44. package/fesm2015/worktile-gantt.js.map +1 -1
  45. package/gantt-abstract.d.ts +12 -0
  46. package/gantt-dom.service.d.ts +3 -0
  47. package/gantt-drag-container.d.ts +3 -0
  48. package/gantt-item-upper.d.ts +3 -0
  49. package/gantt-print.service.d.ts +3 -0
  50. package/gantt-upper.d.ts +6 -2
  51. package/gantt.component.d.ts +5 -3
  52. package/gantt.config.d.ts +23 -0
  53. package/gantt.module.d.ts +19 -0
  54. package/gantt.pipe.d.ts +7 -0
  55. package/package.json +1 -2
  56. package/public-api.d.ts +3 -0
  57. package/root.component.d.ts +3 -0
  58. package/table/gantt-column.component.d.ts +3 -0
  59. package/table/gantt-table.component.d.ts +3 -0
  60. package/utils/helpers.d.ts +2 -1
  61. package/views/view.d.ts +2 -0
  62. package/worktile-gantt.d.ts +1 -11
  63. package/worktile-gantt.metadata.json +0 -1
@@ -2,10 +2,33 @@
2
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
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
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.worktile = global.worktile || {}, global.worktile.gantt = {}), global.ng.core, global.ng.common, global.rxjs.operators, global.rxjs, global.dateFns, global.ng.cdk.coercion, global.ng.cdk.dragDrop, global.html2canvas));
5
- }(this, (function (exports, core, common, operators, rxjs, dateFns, coercion, dragDrop, html2canvas) { 'use strict';
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
 
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () {
19
+ return e[k];
20
+ }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n['default'] = e;
26
+ return Object.freeze(n);
27
+ }
28
+
29
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
30
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
31
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
9
32
  var html2canvas__default = /*#__PURE__*/_interopDefaultLegacy(html2canvas);
10
33
 
11
34
  /*! *****************************************************************************
@@ -636,11 +659,24 @@
636
659
  return GanttGroupInternal;
637
660
  }());
638
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
+
639
674
  var primaryDatePointTop = 18;
640
675
  var secondaryDatePointTop = 36;
641
676
  var viewOptions$5 = {
642
677
  min: new GanttDate().addYears(-1).startOfYear(),
643
- max: new GanttDate().addYears(1).endOfYear()
678
+ max: new GanttDate().addYears(1).endOfYear(),
679
+ dateFormat: defaultConfig.dateFormat
644
680
  };
645
681
  var GanttView = /** @class */ (function () {
646
682
  function GanttView(start, end, options) {
@@ -793,7 +829,7 @@
793
829
  var points = [];
794
830
  for (var i = 0; i < quarters; i++) {
795
831
  var start = this.start.addQuarters(i);
796
- 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);
797
833
  points.push(point);
798
834
  }
799
835
  return points;
@@ -803,7 +839,7 @@
803
839
  var points = [];
804
840
  for (var i = 0; i < months.length; i++) {
805
841
  var start = new GanttDate(months[i]);
806
- 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);
807
843
  points.push(point);
808
844
  }
809
845
  return points;
@@ -842,7 +878,7 @@
842
878
  var points = [];
843
879
  for (var i = 0; i < years.length; i++) {
844
880
  var start = new GanttDate(years[i]);
845
- 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);
846
882
  points.push(point);
847
883
  }
848
884
  return points;
@@ -852,7 +888,7 @@
852
888
  var points = [];
853
889
  for (var i = 0; i <= quarters; i++) {
854
890
  var start = this.start.addQuarters(i);
855
- 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);
856
892
  points.push(point);
857
893
  }
858
894
  return points;
@@ -893,7 +929,7 @@
893
929
  for (var i = 0; i < weeks.length; i++) {
894
930
  var weekStart = new GanttDate(weeks[i]);
895
931
  var increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
896
- 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);
897
933
  points.push(point);
898
934
  }
899
935
  return points;
@@ -944,7 +980,7 @@
944
980
  for (var i = 0; i < weeks.length; i++) {
945
981
  var weekStart = new GanttDate(weeks[i]);
946
982
  var increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
947
- 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);
948
984
  points.push(point);
949
985
  }
950
986
  return points;
@@ -954,7 +990,7 @@
954
990
  var points = [];
955
991
  for (var i = 0; i < weeks.length; i++) {
956
992
  var start = new GanttDate(weeks[i]);
957
- 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);
958
994
  points.push(point);
959
995
  }
960
996
  return points;
@@ -1002,7 +1038,7 @@
1002
1038
  var pointTop = 27;
1003
1039
  for (var i = 0; i <= years; i++) {
1004
1040
  var start = this.start.addYears(i);
1005
- 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);
1006
1042
  points.push(point);
1007
1043
  }
1008
1044
  return points;
@@ -1087,28 +1123,39 @@
1087
1123
  });
1088
1124
  return result;
1089
1125
  }
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
+ }
1133
+ });
1134
+ return result;
1135
+ }
1090
1136
 
1091
1137
  var GanttUpper = /** @class */ (function () {
1092
- function GanttUpper(elementRef, cdr, ngZone) {
1138
+ function GanttUpper(elementRef, cdr, ngZone, config) {
1093
1139
  this.elementRef = elementRef;
1094
1140
  this.cdr = cdr;
1095
1141
  this.ngZone = ngZone;
1142
+ this.config = config;
1096
1143
  this.originItems = [];
1097
1144
  this.originGroups = [];
1098
1145
  this.viewType = exports.GanttViewType.month;
1099
1146
  this.showTodayLine = true;
1100
- this.loadOnScroll = new core.EventEmitter();
1101
- this.dragStarted = new core.EventEmitter();
1102
- this.dragEnded = new core.EventEmitter();
1103
- this.barClick = new core.EventEmitter();
1104
- this.linkDragEnded = new core.EventEmitter();
1147
+ this.viewOptions = {};
1148
+ this.loadOnScroll = new i0.EventEmitter();
1149
+ this.dragStarted = new i0.EventEmitter();
1150
+ this.dragEnded = new i0.EventEmitter();
1151
+ this.barClick = new i0.EventEmitter();
1152
+ this.linkDragEnded = new i0.EventEmitter();
1105
1153
  this.items = [];
1106
1154
  this.groups = [];
1107
- this.viewChange = new core.EventEmitter();
1108
- this.expandChange = new core.EventEmitter();
1155
+ this.viewChange = new i0.EventEmitter();
1156
+ this.expandChange = new i0.EventEmitter();
1109
1157
  this.firstChange = true;
1110
1158
  this.unsubscribe$ = new rxjs.Subject();
1111
- this.expandedItemIds = [];
1112
1159
  this.ganttClass = true;
1113
1160
  }
1114
1161
  Object.defineProperty(GanttUpper.prototype, "element", {
@@ -1136,14 +1183,8 @@
1136
1183
  };
1137
1184
  GanttUpper.prototype.setupItems = function () {
1138
1185
  var _this = this;
1139
- this.items = [];
1140
1186
  this.originItems = uniqBy(this.originItems, 'id');
1141
- // 根据上一次数据展开状态同步新的数据展开状态
1142
- this.originItems.forEach(function (item) {
1143
- if (!_this.firstChange) {
1144
- item.expanded = _this.expandedItemIds.includes(item.id);
1145
- }
1146
- });
1187
+ this.items = [];
1147
1188
  if (this.groups.length > 0) {
1148
1189
  this.originItems.forEach(function (origin) {
1149
1190
  var group = _this.groupsMap[origin.group_id];
@@ -1161,18 +1202,23 @@
1161
1202
  }
1162
1203
  };
1163
1204
  GanttUpper.prototype.setupExpandedState = function () {
1164
- var _this = this;
1205
+ this.originItems = uniqBy(this.originItems, 'id');
1165
1206
  var items = [];
1207
+ var flatOriginItems = getFlatItems(this.originItems);
1166
1208
  if (this.items.length > 0) {
1167
1209
  items = recursiveItems(this.items);
1168
1210
  }
1169
1211
  else {
1170
1212
  items = flatten(this.groups.map(function (group) { return recursiveItems(group.items); }));
1171
1213
  }
1172
- this.expandedItemIds = [];
1173
1214
  items.forEach(function (item) {
1174
1215
  if (item.origin.expanded) {
1175
- _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
+ }
1176
1222
  }
1177
1223
  });
1178
1224
  };
@@ -1220,6 +1266,7 @@
1220
1266
  GanttUpper.prototype.onInit = function () {
1221
1267
  var _this = this;
1222
1268
  this.styles = Object.assign({}, defaultStyles, this.styles);
1269
+ this.viewOptions.dateFormat = Object.assign({}, defaultConfig.dateFormat, this.config.dateFormat, this.viewOptions.dateFormat);
1223
1270
  this.createView();
1224
1271
  this.setupGroups();
1225
1272
  this.setupItems();
@@ -1295,37 +1342,65 @@
1295
1342
  };
1296
1343
  return GanttUpper;
1297
1344
  }());
1298
- GanttUpper.decorators = [
1299
- { type: core.Directive }
1300
- ];
1301
- GanttUpper.ctorParameters = function () { return [
1302
- { type: core.ElementRef },
1303
- { type: core.ChangeDetectorRef },
1304
- { type: core.NgZone }
1305
- ]; };
1306
- GanttUpper.propDecorators = {
1307
- originItems: [{ type: core.Input, args: ['items',] }],
1308
- originGroups: [{ type: core.Input, args: ['groups',] }],
1309
- viewType: [{ type: core.Input }],
1310
- start: [{ type: core.Input }],
1311
- end: [{ type: core.Input }],
1312
- showTodayLine: [{ type: core.Input }],
1313
- draggable: [{ type: core.Input }],
1314
- styles: [{ type: core.Input }],
1315
- viewOptions: [{ type: core.Input }],
1316
- disabledLoadOnScroll: [{ type: core.Input }],
1317
- loadOnScroll: [{ type: core.Output }],
1318
- dragStarted: [{ type: core.Output }],
1319
- dragEnded: [{ type: core.Output }],
1320
- barClick: [{ type: core.Output }],
1321
- barTemplate: [{ type: core.ContentChild, args: ['bar', { static: true },] }],
1322
- rangeTemplate: [{ type: core.ContentChild, args: ['range', { static: true },] }],
1323
- itemTemplate: [{ type: core.ContentChild, args: ['item', { static: true },] }],
1324
- groupTemplate: [{ type: core.ContentChild, args: ['group', { static: true },] }],
1325
- groupHeaderTemplate: [{ type: core.ContentChild, args: ['groupHeader', { static: true },] }],
1326
- ganttClass: [{ type: core.HostBinding, args: ['class.gantt',] }]
1327
- };
1328
- var GANTT_UPPER_TOKEN = new core.InjectionToken('GANTT_UPPER_TOKEN');
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 });
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 });
1347
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttUpper, decorators: [{
1348
+ type: i0.Directive
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: [{
1355
+ type: i0.Input,
1356
+ args: ['items']
1357
+ }], originGroups: [{
1358
+ type: i0.Input,
1359
+ args: ['groups']
1360
+ }], viewType: [{
1361
+ type: i0.Input
1362
+ }], start: [{
1363
+ type: i0.Input
1364
+ }], end: [{
1365
+ type: i0.Input
1366
+ }], showTodayLine: [{
1367
+ type: i0.Input
1368
+ }], draggable: [{
1369
+ type: i0.Input
1370
+ }], styles: [{
1371
+ type: i0.Input
1372
+ }], viewOptions: [{
1373
+ type: i0.Input
1374
+ }], disabledLoadOnScroll: [{
1375
+ type: i0.Input
1376
+ }], loadOnScroll: [{
1377
+ type: i0.Output
1378
+ }], dragStarted: [{
1379
+ type: i0.Output
1380
+ }], dragEnded: [{
1381
+ type: i0.Output
1382
+ }], barClick: [{
1383
+ type: i0.Output
1384
+ }], barTemplate: [{
1385
+ type: i0.ContentChild,
1386
+ args: ['bar', { static: true }]
1387
+ }], rangeTemplate: [{
1388
+ type: i0.ContentChild,
1389
+ args: ['range', { static: true }]
1390
+ }], itemTemplate: [{
1391
+ type: i0.ContentChild,
1392
+ args: ['item', { static: true }]
1393
+ }], groupTemplate: [{
1394
+ type: i0.ContentChild,
1395
+ args: ['group', { static: true }]
1396
+ }], groupHeaderTemplate: [{
1397
+ type: i0.ContentChild,
1398
+ args: ['groupHeader', { static: true }]
1399
+ }], ganttClass: [{
1400
+ type: i0.HostBinding,
1401
+ args: ['class.gantt']
1402
+ }] } });
1403
+ var GANTT_UPPER_TOKEN = new i0.InjectionToken('GANTT_UPPER_TOKEN');
1329
1404
 
1330
1405
  var NgxGanttTableColumnComponent = /** @class */ (function () {
1331
1406
  function NgxGanttTableColumnComponent(ganttUpper) {
@@ -1341,223 +1416,158 @@
1341
1416
  NgxGanttTableColumnComponent.prototype.ngOnInit = function () { };
1342
1417
  return NgxGanttTableColumnComponent;
1343
1418
  }());
1344
- NgxGanttTableColumnComponent.decorators = [
1345
- { type: core.Component, args: [{
1346
- selector: 'ngx-gantt-column',
1347
- template: ''
1348
- },] }
1349
- ];
1350
- NgxGanttTableColumnComponent.ctorParameters = function () { return [
1351
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] }
1352
- ]; };
1353
- NgxGanttTableColumnComponent.propDecorators = {
1354
- width: [{ type: core.Input }],
1355
- name: [{ type: core.Input }],
1356
- templateRef: [{ type: core.ContentChild, args: ['cell', { static: true },] }],
1357
- headerTemplateRef: [{ type: core.ContentChild, args: ['header', { static: true },] }]
1358
- };
1419
+ NgxGanttTableColumnComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttTableColumnComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Component });
1420
+ NgxGanttTableColumnComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: NgxGanttTableColumnComponent, selector: "ngx-gantt-column", inputs: { width: "width", name: "name" }, queries: [{ propertyName: "templateRef", first: true, predicate: ["cell"], descendants: true, static: true }, { propertyName: "headerTemplateRef", first: true, predicate: ["header"], descendants: true, static: true }], ngImport: i0__namespace, template: '', isInline: true });
1421
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttTableColumnComponent, decorators: [{
1422
+ type: i0.Component,
1423
+ args: [{
1424
+ selector: 'ngx-gantt-column',
1425
+ template: ''
1426
+ }]
1427
+ }], ctorParameters: function () {
1428
+ return [{ type: GanttUpper, decorators: [{
1429
+ type: i0.Inject,
1430
+ args: [GANTT_UPPER_TOKEN]
1431
+ }] }];
1432
+ }, propDecorators: { width: [{
1433
+ type: i0.Input
1434
+ }], name: [{
1435
+ type: i0.Input
1436
+ }], templateRef: [{
1437
+ type: i0.ContentChild,
1438
+ args: ['cell', { static: true }]
1439
+ }], headerTemplateRef: [{
1440
+ type: i0.ContentChild,
1441
+ args: ['header', { static: true }]
1442
+ }] } });
1359
1443
 
1360
1444
  var NgxGanttTableComponent = /** @class */ (function () {
1361
1445
  function NgxGanttTableComponent() {
1362
- this.columnChanges = new core.EventEmitter();
1446
+ this.columnChanges = new i0.EventEmitter();
1363
1447
  }
1364
1448
  NgxGanttTableComponent.prototype.ngOnInit = function () { };
1365
1449
  return NgxGanttTableComponent;
1366
1450
  }());
1367
- NgxGanttTableComponent.decorators = [
1368
- { type: core.Component, args: [{
1369
- selector: 'ngx-gantt-table',
1370
- template: ''
1371
- },] }
1372
- ];
1373
- NgxGanttTableComponent.ctorParameters = function () { return []; };
1374
- NgxGanttTableComponent.propDecorators = {
1375
- columnChanges: [{ type: core.Output }]
1376
- };
1451
+ NgxGanttTableComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttTableComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1452
+ NgxGanttTableComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: NgxGanttTableComponent, selector: "ngx-gantt-table", outputs: { columnChanges: "columnChanges" }, ngImport: i0__namespace, template: '', isInline: true });
1453
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttTableComponent, decorators: [{
1454
+ type: i0.Component,
1455
+ args: [{
1456
+ selector: 'ngx-gantt-table',
1457
+ template: ''
1458
+ }]
1459
+ }], ctorParameters: function () { return []; }, propDecorators: { columnChanges: [{
1460
+ type: i0.Output
1461
+ }] } });
1377
1462
 
1378
- var defaultColumnWidth = 100;
1379
- var minColumnWidth = 80;
1380
- var NgxGanttComponent = /** @class */ (function (_super) {
1381
- __extends(NgxGanttComponent, _super);
1382
- function NgxGanttComponent(elementRef, cdr, ngZone) {
1383
- var _this = _super.call(this, elementRef, cdr, ngZone) || this;
1384
- _this.maxLevel = 2;
1385
- _this.linkDragStarted = new core.EventEmitter();
1386
- _this.linkDragEnded = new core.EventEmitter();
1387
- _this.lineClick = new core.EventEmitter();
1388
- _this.ngUnsubscribe$ = new rxjs.Subject();
1389
- _this.sideTableWidth = sideWidth;
1390
- return _this;
1391
- }
1392
- NgxGanttComponent.prototype.ngOnInit = function () {
1393
- var _this = this;
1394
- _super.prototype.onInit.call(this);
1395
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
1396
- _this.dragContainer.linkDragStarted.pipe(operators.takeUntil(_this.ngUnsubscribe$)).subscribe(function (event) {
1397
- _this.linkDragStarted.emit(event);
1398
- });
1399
- _this.dragContainer.linkDragEnded.pipe(operators.takeUntil(_this.ngUnsubscribe$)).subscribe(function (event) {
1400
- _this.linkDragEnded.emit(event);
1401
- });
1402
- });
1403
- };
1404
- NgxGanttComponent.prototype.ngAfterViewInit = function () {
1405
- var _this = this;
1406
- this.columns.changes.pipe(operators.startWith(true), operators.takeUntil(this.ngUnsubscribe$)).subscribe(function () {
1407
- _this.columns.forEach(function (column) {
1408
- if (!column.columnWidth) {
1409
- column.columnWidth = coercion.coerceCssPixelValue(defaultColumnWidth);
1410
- }
1411
- });
1412
- _this.cdr.detectChanges();
1413
- });
1414
- };
1415
- NgxGanttComponent.prototype.ngOnChanges = function (changes) {
1416
- _super.prototype.onChanges.call(this, changes);
1417
- };
1418
- NgxGanttComponent.prototype.expandChildren = function (item) {
1419
- var _this = this;
1420
- if (!item.expanded) {
1421
- item.setExpand(true);
1422
- if (this.async && this.childrenResolve && item.children.length === 0) {
1423
- item.loading = true;
1424
- this.childrenResolve(item.origin)
1425
- .pipe(operators.take(1), operators.finalize(function () {
1426
- item.loading = false;
1427
- _this.expandChange.emit();
1428
- _this.cdr.detectChanges();
1429
- }))
1430
- .subscribe(function (items) {
1431
- item.addChildren(items);
1432
- _this.computeItemsRefs.apply(_this, __spreadArray([], __read(item.children)));
1433
- });
1434
- }
1435
- else {
1436
- this.computeItemsRefs.apply(this, __spreadArray([], __read(item.children)));
1437
- this.expandChange.emit();
1438
- }
1439
- }
1440
- else {
1441
- item.setExpand(false);
1442
- this.expandChange.emit();
1443
- }
1444
- };
1445
- NgxGanttComponent.prototype.ngOnDestroy = function () {
1446
- _super.prototype.onDestroy.call(this);
1447
- };
1448
- return NgxGanttComponent;
1449
- }(GanttUpper));
1450
- NgxGanttComponent.decorators = [
1451
- { type: core.Component, args: [{
1452
- selector: 'ngx-gantt',
1453
- 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",
1454
- changeDetection: core.ChangeDetectionStrategy.OnPush,
1455
- providers: [
1456
- {
1457
- provide: GANTT_UPPER_TOKEN,
1458
- useExisting: NgxGanttComponent
1459
- }
1460
- ]
1461
- },] }
1462
- ];
1463
- NgxGanttComponent.ctorParameters = function () { return [
1464
- { type: core.ElementRef },
1465
- { type: core.ChangeDetectorRef },
1466
- { type: core.NgZone }
1467
- ]; };
1468
- NgxGanttComponent.propDecorators = {
1469
- maxLevel: [{ type: core.Input }],
1470
- async: [{ type: core.Input }],
1471
- childrenResolve: [{ type: core.Input }],
1472
- linkable: [{ type: core.Input }],
1473
- linkDragStarted: [{ type: core.Output }],
1474
- linkDragEnded: [{ type: core.Output }],
1475
- lineClick: [{ type: core.Output }],
1476
- table: [{ type: core.ContentChild, args: [NgxGanttTableComponent,] }],
1477
- columns: [{ type: core.ContentChildren, args: [NgxGanttTableColumnComponent, { descendants: true },] }],
1478
- tableEmptyTemplate: [{ type: core.ContentChild, args: ['tableEmpty', { static: true },] }]
1463
+ var GANTT_ABSTRACT_TOKEN = new i0.InjectionToken('gantt-abstract-token');
1464
+
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
1479
1478
  };
1480
1479
 
1481
- var mainHeight = 5000;
1482
- var GanttCalendarComponent = /** @class */ (function () {
1483
- function GanttCalendarComponent(ganttUpper, ngZone, elementRef) {
1484
- this.ganttUpper = ganttUpper;
1485
- this.ngZone = ngZone;
1480
+ var GanttIconComponent = /** @class */ (function () {
1481
+ function GanttIconComponent(elementRef) {
1486
1482
  this.elementRef = elementRef;
1487
- this.unsubscribe$ = new rxjs.Subject();
1488
- this.headerHeight = headerHeight;
1489
- this.mainHeight = mainHeight;
1490
- this.todayHeight = todayHeight;
1491
- this.todayWidth = todayWidth;
1492
- this.todayBorderRadius = todayBorderRadius;
1493
- this.viewTypes = exports.GanttViewType;
1494
- this.className = true;
1483
+ this.isIcon = true;
1495
1484
  }
1496
- Object.defineProperty(GanttCalendarComponent.prototype, "view", {
1497
- get: function () {
1498
- return this.ganttUpper.view;
1485
+ Object.defineProperty(GanttIconComponent.prototype, "iconName", {
1486
+ set: function (name) {
1487
+ this.setSvg(name);
1499
1488
  },
1500
1489
  enumerable: false,
1501
1490
  configurable: true
1502
1491
  });
1503
- GanttCalendarComponent.prototype.setTodayPoint = function () {
1504
- var x = this.view.getTodayXPoint();
1505
- var today = new GanttDate().getDate();
1506
- var todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
1507
- var rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
1508
- var line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
1509
- if (isNumber(x)) {
1510
- if (rect) {
1511
- rect.style.left = x - todayWidth / 2 + "px";
1512
- rect.style.top = headerHeight - todayHeight + "px";
1513
- rect.innerHTML = today.toString();
1514
- }
1515
- if (line) {
1516
- line.style.left = x + "px";
1517
- line.style.top = headerHeight + "px";
1518
- line.style.bottom = -mainHeight + "px";
1519
- }
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;
1520
1498
  }
1521
1499
  else {
1522
- todayEle.style.display = 'none';
1500
+ this.elementRef.nativeElement.innerHTML = '';
1523
1501
  }
1524
1502
  };
1525
- GanttCalendarComponent.prototype.ngOnInit = function () {
1526
- var _this = this;
1527
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
1528
- rxjs.merge(_this.ganttUpper.viewChange, _this.ganttUpper.view.start$)
1529
- .pipe(operators.takeUntil(_this.unsubscribe$))
1530
- .subscribe(function () {
1531
- _this.setTodayPoint();
1532
- });
1533
- });
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;
1534
1525
  };
1535
- GanttCalendarComponent.prototype.ngAfterViewInit = function () { };
1536
- GanttCalendarComponent.prototype.ngOnChanges = function (changes) { };
1537
- GanttCalendarComponent.prototype.trackBy = function (point, index) {
1538
- return point.text || index;
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;
1539
1541
  };
1540
- GanttCalendarComponent.prototype.ngOnDestroy = function () {
1541
- this.unsubscribe$.next();
1542
- this.unsubscribe$.complete();
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;
1543
1557
  };
1544
- return GanttCalendarComponent;
1558
+ return IsGanttCustomItemPipe;
1545
1559
  }());
1546
- GanttCalendarComponent.decorators = [
1547
- { type: core.Component, args: [{
1548
- selector: 'gantt-calendar-overlay',
1549
- 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"
1550
- },] }
1551
- ];
1552
- GanttCalendarComponent.ctorParameters = function () { return [
1553
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] },
1554
- { type: core.NgZone },
1555
- { type: core.ElementRef }
1556
- ]; };
1557
- GanttCalendarComponent.propDecorators = {
1558
- className: [{ type: core.HostBinding, args: ['class.gantt-calendar-overlay',] }]
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
+ }] });
1560
1568
 
1569
+ var defaultColumnWidth = 100;
1570
+ var minColumnWidth = 80;
1561
1571
  var GanttTableComponent = /** @class */ (function () {
1562
1572
  function GanttTableComponent(gantt, elementRef) {
1563
1573
  this.gantt = gantt;
@@ -1583,6 +1593,9 @@
1583
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)) {
1584
1594
  this.ganttTableEmptyClass = true;
1585
1595
  }
1596
+ else {
1597
+ this.ganttTableEmptyClass = false;
1598
+ }
1586
1599
  };
1587
1600
  GanttTableComponent.prototype.dragFixed = function (config) {
1588
1601
  if (config.movedWidth < config.minWidth) {
@@ -1664,26 +1677,39 @@
1664
1677
  };
1665
1678
  return GanttTableComponent;
1666
1679
  }());
1667
- GanttTableComponent.decorators = [
1668
- { type: core.Component, args: [{
1669
- selector: 'gantt-table',
1670
- 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"
1671
- },] }
1672
- ];
1673
- GanttTableComponent.ctorParameters = function () { return [
1674
- { type: NgxGanttComponent },
1675
- { type: core.ElementRef }
1676
- ]; };
1677
- GanttTableComponent.propDecorators = {
1678
- groups: [{ type: core.Input }],
1679
- items: [{ type: core.Input }],
1680
- columns: [{ type: core.Input }],
1681
- groupTemplate: [{ type: core.Input }],
1682
- emptyTemplate: [{ type: core.Input }],
1683
- draglineElementRef: [{ type: core.ViewChild, args: ['dragLine', { static: true },] }],
1684
- ganttTableClass: [{ type: core.HostBinding, args: ['class.gantt-table',] }],
1685
- ganttTableEmptyClass: [{ type: core.HostBinding, args: ['class.gantt-table-empty',] }]
1686
- };
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: [{
1683
+ type: i0.Component,
1684
+ args: [{
1685
+ selector: 'gantt-table',
1686
+ templateUrl: './gantt-table.component.html'
1687
+ }]
1688
+ }], ctorParameters: function () {
1689
+ return [{ type: undefined, decorators: [{
1690
+ type: i0.Inject,
1691
+ args: [GANTT_ABSTRACT_TOKEN]
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: [{
1702
+ type: i0.Input
1703
+ }], draglineElementRef: [{
1704
+ type: i0.ViewChild,
1705
+ args: ['dragLine', { static: true }]
1706
+ }], ganttTableClass: [{
1707
+ type: i0.HostBinding,
1708
+ args: ['class.gantt-table']
1709
+ }], ganttTableEmptyClass: [{
1710
+ type: i0.HostBinding,
1711
+ args: ['class.gantt-table-empty']
1712
+ }] } });
1687
1713
 
1688
1714
  var scrollThreshold = 50;
1689
1715
  var ScrollDirection;
@@ -1781,18 +1807,19 @@
1781
1807
  };
1782
1808
  return GanttDomService;
1783
1809
  }());
1784
- GanttDomService.decorators = [
1785
- { type: core.Injectable }
1786
- ];
1787
- GanttDomService.ctorParameters = function () { return []; };
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 []; } });
1788
1815
 
1789
1816
  var GanttDragContainer = /** @class */ (function () {
1790
1817
  function GanttDragContainer() {
1791
- this.dragStarted = new core.EventEmitter();
1792
- this.dragEnded = new core.EventEmitter();
1793
- this.linkDragStarted = new core.EventEmitter();
1794
- this.linkDragEntered = new core.EventEmitter();
1795
- this.linkDragEnded = new core.EventEmitter();
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();
1796
1823
  }
1797
1824
  GanttDragContainer.prototype.emitLinkDragStarted = function (from, item) {
1798
1825
  this.linkDraggingId = item.id;
@@ -1838,527 +1865,360 @@
1838
1865
  };
1839
1866
  return GanttDragContainer;
1840
1867
  }());
1841
- GanttDragContainer.decorators = [
1842
- { type: core.Injectable }
1843
- ];
1844
- GanttDragContainer.ctorParameters = function () { return []; };
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 []; } });
1845
1873
 
1846
- var dragMinWidth = 10;
1847
- var activeClass = 'gantt-bar-active';
1848
- var linkDropClass = 'gantt-bar-link-drop';
1849
- function createSvgElement(qualifiedName, className) {
1850
- var element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
1851
- element.classList.add(className);
1852
- return element;
1853
- }
1854
- var GanttBarDrag = /** @class */ (function () {
1855
- function GanttBarDrag(dragDrop, dom, dragContainer) {
1856
- this.dragDrop = dragDrop;
1857
- this.dom = dom;
1858
- this.dragContainer = dragContainer;
1859
- this.dragRefs = [];
1860
- this.destroy$ = new rxjs.Subject();
1874
+ var GanttPrintService = /** @class */ (function () {
1875
+ function GanttPrintService() {
1861
1876
  }
1862
- Object.defineProperty(GanttBarDrag.prototype, "dragDisabled", {
1863
- get: function () {
1864
- return !this.item.draggable || !this.ganttUpper.draggable;
1865
- },
1866
- enumerable: false,
1867
- configurable: true
1868
- });
1869
- Object.defineProperty(GanttBarDrag.prototype, "linkDragDisabled", {
1870
- get: function () {
1871
- return !this.item.linkable || !this.ganttUpper.linkable;
1872
- },
1873
- enumerable: false,
1874
- configurable: true
1875
- });
1876
- GanttBarDrag.prototype.createMouseEvents = function () {
1877
- var _this = this;
1878
- rxjs.fromEvent(this.barElement, 'mouseenter')
1879
- .pipe(operators.takeUntil(this.destroy$))
1880
- .subscribe(function () {
1881
- if (_this.dragContainer.linkDraggingId && _this.dragContainer.linkDraggingId !== _this.item.id) {
1882
- if (_this.item.linkable) {
1883
- _this.barElement.classList.add(linkDropClass);
1884
- _this.dragContainer.emitLinkDragEntered(_this.item);
1885
- }
1886
- }
1887
- else {
1888
- _this.barElement.classList.add(activeClass);
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);
1889
1884
  }
1890
- });
1891
- rxjs.fromEvent(this.barElement, 'mouseleave')
1892
- .pipe(operators.takeUntil(this.destroy$))
1893
- .subscribe(function () {
1894
- if (!_this.dragContainer.linkDraggingId) {
1895
- _this.barElement.classList.remove(activeClass);
1896
- }
1897
- else {
1898
- _this.dragContainer.emitLinkDragLeaved();
1899
- }
1900
- _this.barElement.classList.remove(linkDropClass);
1901
- });
1902
- };
1903
- GanttBarDrag.prototype.createBarDrag = function () {
1904
- var _this = this;
1905
- var dragRef = this.dragDrop.createDrag(this.barElement);
1906
- dragRef.lockAxis = 'x';
1907
- dragRef.started.subscribe(function () {
1908
- _this.setDraggingStyles();
1909
- _this.dragContainer.dragStarted.emit({ item: _this.item.origin });
1910
- });
1911
- dragRef.moved.subscribe(function (event) {
1912
- var x = _this.item.refs.x + event.distance.x;
1913
- var days = dateFns.differenceInCalendarDays(_this.item.end.value, _this.item.start.value);
1914
- var start = _this.ganttUpper.view.getDateByXPoint(x);
1915
- var end = start.addDays(days);
1916
- _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), end);
1917
- });
1918
- dragRef.ended.subscribe(function (event) {
1919
- var days = dateFns.differenceInCalendarDays(_this.item.end.value, _this.item.start.value);
1920
- var start = _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + event.distance.x);
1921
- var end = start.addDays(days);
1922
- _this.item.updateDate(start, end);
1923
- _this.clearDraggingStyles();
1924
- _this.closeDragBackdrop();
1925
- event.source.reset();
1926
- _this.dragContainer.dragEnded.emit({ item: _this.item.origin });
1927
- });
1928
- this.barDragRef = dragRef;
1929
- return dragRef;
1930
- };
1931
- GanttBarDrag.prototype.createBarHandleDrags = function () {
1932
- var _this = this;
1933
- var dragRefs = [];
1934
- var handles = this.barElement.querySelectorAll('.drag-handles .handle');
1935
- handles.forEach(function (handle, index) {
1936
- var isBefore = index === 0;
1937
- var dragRef = _this.dragDrop.createDrag(handle);
1938
- dragRef.lockAxis = 'x';
1939
- dragRef.withBoundaryElement(_this.dom.root);
1940
- dragRef.started.subscribe(function () {
1941
- _this.setDraggingStyles();
1942
- _this.dragContainer.dragStarted.emit({ item: _this.item.origin });
1943
- });
1944
- dragRef.moved.subscribe(function (event) {
1945
- if (isBefore) {
1946
- var x = _this.item.refs.x + event.distance.x;
1947
- var width = _this.item.refs.width + event.distance.x * -1;
1948
- if (width > dragMinWidth) {
1949
- _this.barElement.style.width = width + 'px';
1950
- _this.barElement.style.left = x + 'px';
1951
- _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), _this.ganttUpper.view.getDateByXPoint(x + width));
1952
- }
1953
- }
1954
- else {
1955
- var width = _this.item.refs.width + event.distance.x;
1956
- if (width > dragMinWidth) {
1957
- _this.barElement.style.width = width + 'px';
1958
- _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x), _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + width));
1959
- }
1960
- }
1961
- event.source.reset();
1962
- });
1963
- dragRef.ended.subscribe(function (event) {
1964
- if (isBefore) {
1965
- var width = _this.item.refs.width + event.distance.x * -1;
1966
- if (width > dragMinWidth) {
1967
- _this.item.updateDate(_this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + event.distance.x), _this.item.end);
1968
- }
1969
- else {
1970
- _this.item.updateDate(_this.item.end.startOfDay(), _this.item.end);
1971
- }
1972
- }
1973
- else {
1974
- var width = _this.item.refs.width + event.distance.x;
1975
- if (width > dragMinWidth) {
1976
- _this.item.updateDate(_this.item.start, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + _this.item.refs.width + event.distance.x));
1977
- }
1978
- else {
1979
- _this.item.updateDate(_this.item.start, _this.item.start.endOfDay());
1980
- }
1981
- }
1982
- _this.clearDraggingStyles();
1983
- _this.closeDragBackdrop();
1984
- _this.dragContainer.dragEnded.emit({ item: _this.item.origin });
1985
- });
1986
- dragRefs.push(dragRef);
1987
- });
1988
- return dragRefs;
1989
- };
1990
- GanttBarDrag.prototype.createLinkHandleDrags = function () {
1991
- var _this = this;
1992
- var dragRefs = [];
1993
- var handles = this.barElement.querySelectorAll('.link-handles .handle');
1994
- handles.forEach(function (handle, index) {
1995
- var isBefore = index === 0;
1996
- var dragRef = _this.dragDrop.createDrag(handle);
1997
- dragRef.withBoundaryElement(_this.dom.root);
1998
- dragRef.beforeStarted.subscribe(function () {
1999
- handle.style.pointerEvents = 'none';
2000
- if (_this.barDragRef) {
2001
- _this.barDragRef.disabled = true;
2002
- }
2003
- _this.createLinkDraggingLine();
2004
- _this.dragContainer.emitLinkDragStarted(isBefore ? 'target' : 'source', _this.item);
2005
- });
2006
- dragRef.moved.subscribe(function () {
2007
- var positions = _this.calcLinkLinePositions(handle, isBefore);
2008
- _this.linkDraggingLine.setAttribute('x1', positions.x1.toString());
2009
- _this.linkDraggingLine.setAttribute('y1', positions.y1.toString());
2010
- _this.linkDraggingLine.setAttribute('x2', positions.x2.toString());
2011
- _this.linkDraggingLine.setAttribute('y2', positions.y2.toString());
2012
- });
2013
- dragRef.ended.subscribe(function (event) {
2014
- event.source.reset();
2015
- handle.style.pointerEvents = '';
2016
- if (_this.barDragRef) {
2017
- _this.barDragRef.disabled = false;
2018
- }
2019
- _this.barElement.classList.remove(activeClass);
2020
- _this.destroyLinkDraggingLine();
2021
- _this.dragContainer.emitLinkDragEnded();
2022
- });
2023
- dragRefs.push(dragRef);
2024
- });
2025
- return dragRefs;
2026
- };
2027
- GanttBarDrag.prototype.openDragBackdrop = function (dragElement, start, end) {
2028
- var dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
2029
- var dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
2030
- var rootRect = this.dom.root.getBoundingClientRect();
2031
- var dragRect = dragElement.getBoundingClientRect();
2032
- var left = dragRect.left - rootRect.left - this.dom.side.clientWidth;
2033
- var width = dragRect.right - dragRect.left;
2034
- dragMaskElement.style.left = left + 'px';
2035
- dragMaskElement.style.width = width + 'px';
2036
- dragMaskElement.querySelector('.start').innerHTML = start.format('MM-dd');
2037
- dragMaskElement.querySelector('.end').innerHTML = end.format('MM-dd');
2038
- dragMaskElement.style.display = 'block';
2039
- dragBackdropElement.style.display = 'block';
2040
- };
2041
- GanttBarDrag.prototype.closeDragBackdrop = function () {
2042
- var dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
2043
- var dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
2044
- dragMaskElement.style.display = 'none';
2045
- dragBackdropElement.style.display = 'none';
2046
- };
2047
- GanttBarDrag.prototype.setDraggingStyles = function () {
2048
- this.barElement.style.pointerEvents = 'none';
2049
- this.barElement.classList.add('gantt-bar-draggable-drag');
2050
- };
2051
- GanttBarDrag.prototype.clearDraggingStyles = function () {
2052
- this.barElement.style.pointerEvents = '';
2053
- this.barElement.classList.remove('gantt-bar-draggable-drag');
2054
- };
2055
- GanttBarDrag.prototype.calcLinkLinePositions = function (target, isBefore) {
2056
- var rootRect = this.dom.root.getBoundingClientRect();
2057
- var targetRect = target.getBoundingClientRect();
2058
- var layerRect = target.parentElement.parentElement.getBoundingClientRect();
2059
- return {
2060
- x1: layerRect.left + (isBefore ? 0 : layerRect.width) - rootRect.left,
2061
- y1: layerRect.top + layerRect.height / 2 - rootRect.top,
2062
- x2: targetRect.left - rootRect.left + targetRect.width / 2,
2063
- y2: targetRect.top - rootRect.top + targetRect.height / 2
2064
- };
2065
- };
2066
- GanttBarDrag.prototype.createLinkDraggingLine = function () {
2067
- if (!this.linkDraggingLine) {
2068
- var svgElement = createSvgElement('svg', 'gantt-link-drag-container');
2069
- var linElement = createSvgElement('line', 'link-dragging-line');
2070
- svgElement.appendChild(linElement);
2071
- this.dom.root.appendChild(svgElement);
2072
- this.linkDraggingLine = linElement;
2073
1885
  }
2074
- };
2075
- GanttBarDrag.prototype.destroyLinkDraggingLine = function () {
2076
- if (this.linkDraggingLine) {
2077
- this.linkDraggingLine.parentElement.remove();
2078
- this.linkDraggingLine = null;
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; }
2079
1892
  }
2080
1893
  };
2081
- GanttBarDrag.prototype.createDrags = function (elementRef, item, ganttUpper) {
2082
- var _a, _b;
2083
- this.item = item;
2084
- this.barElement = elementRef.nativeElement;
2085
- this.ganttUpper = ganttUpper;
2086
- if (!item.draggable || (this.dragDisabled && this.linkDragDisabled)) {
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) {
2087
1908
  return;
2088
1909
  }
2089
- else {
2090
- this.createMouseEvents();
2091
- if (!this.dragDisabled) {
2092
- var dragRef = this.createBarDrag();
2093
- var dragHandlesRefs = this.createBarHandleDrags();
2094
- (_a = this.dragRefs).push.apply(_a, __spreadArray([dragRef], __read(dragHandlesRefs)));
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];
2095
1915
  }
2096
- if (!this.linkDragDisabled) {
2097
- var linkDragRefs = this.createLinkHandleDrags();
2098
- (_b = this.dragRefs).push.apply(_b, __spreadArray([], __read(linkDragRefs)));
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);
2099
1928
  }
2100
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
+ }
2101
1937
  };
2102
- GanttBarDrag.prototype.ngOnDestroy = function () {
2103
- this.closeDragBackdrop();
2104
- this.dragRefs.forEach(function (dragRef) { return dragRef.dispose(); });
2105
- this.destroy$.next();
2106
- this.destroy$.complete();
1938
+ GanttPrintService.prototype.register = function (root) {
1939
+ this.root = root.nativeElement;
1940
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
2107
1941
  };
2108
- return GanttBarDrag;
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)) {
1959
+ return true;
1960
+ }
1961
+ if (element.classList.contains('gantt-calendar-today-overlay')) {
1962
+ return true;
1963
+ }
1964
+ },
1965
+ onclone: function (cloneDocument) {
1966
+ var ganttClass = root.className;
1967
+ var cloneGanttDom = cloneDocument.querySelector("." + ganttClass.replace(/\s+/g, '.'));
1968
+ var cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
1969
+ var cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
1970
+ var cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
1971
+ // change targetDom width
1972
+ cloneGanttDom.style.width = printWidth + "px";
1973
+ cloneGanttDom.style.height = printHeight + "px";
1974
+ cloneGanttDom.style.overflow = "unset";
1975
+ cloneGanttContainerDom.style.backgroundColor = '#fff';
1976
+ cloneCalendarOverlay.setAttribute('height', "" + printHeight);
1977
+ cloneCalendarOverlay.setAttribute('style', "background: transparent");
1978
+ if (cloneLinksOverlay) {
1979
+ cloneLinksOverlay.setAttribute('height', "" + printHeight);
1980
+ cloneLinksOverlay.setAttribute('style', "height: " + printHeight + "px");
1981
+ }
1982
+ // setInlineStyles for svg
1983
+ _this.setInlineStyles(cloneGanttDom);
1984
+ }
1985
+ }).then(function (canvas) {
1986
+ var link = document.createElement('a');
1987
+ var dataUrl = canvas.toDataURL('image/png');
1988
+ link.download = name + ".png";
1989
+ link.href = dataUrl;
1990
+ link.click();
1991
+ });
1992
+ };
1993
+ return GanttPrintService;
2109
1994
  }());
2110
- GanttBarDrag.decorators = [
2111
- { type: core.Injectable }
2112
- ];
2113
- GanttBarDrag.ctorParameters = function () { return [
2114
- { type: dragDrop.DragDrop },
2115
- { type: GanttDomService },
2116
- { type: GanttDragContainer }
2117
- ]; };
1995
+ GanttPrintService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttPrintService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1996
+ GanttPrintService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttPrintService });
1997
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttPrintService, decorators: [{
1998
+ type: i0.Injectable
1999
+ }], ctorParameters: function () { return []; } });
2118
2000
 
2119
- var GanttItemUpper = /** @class */ (function () {
2120
- function GanttItemUpper(elementRef, ganttUpper) {
2121
- this.elementRef = elementRef;
2001
+ var mainHeight = 5000;
2002
+ var GanttCalendarComponent = /** @class */ (function () {
2003
+ function GanttCalendarComponent(ganttUpper, ngZone, elementRef) {
2122
2004
  this.ganttUpper = ganttUpper;
2123
- this.firstChange = true;
2005
+ this.ngZone = ngZone;
2006
+ this.elementRef = elementRef;
2124
2007
  this.unsubscribe$ = new rxjs.Subject();
2008
+ this.headerHeight = headerHeight;
2009
+ this.mainHeight = mainHeight;
2010
+ this.todayHeight = todayHeight;
2011
+ this.todayWidth = todayWidth;
2012
+ this.todayBorderRadius = todayBorderRadius;
2013
+ this.viewTypes = exports.GanttViewType;
2014
+ this.className = true;
2125
2015
  }
2126
- GanttItemUpper.prototype.onInit = function () {
2127
- var _this = this;
2128
- this.firstChange = false;
2129
- this.item.refs$.pipe(operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2130
- _this.setPositions();
2131
- });
2132
- };
2133
- GanttItemUpper.prototype.onChanges = function () {
2134
- if (!this.firstChange) {
2135
- this.setPositions();
2136
- }
2137
- };
2138
- GanttItemUpper.prototype.setPositions = function () {
2139
- var itemElement = this.elementRef.nativeElement;
2140
- itemElement.style.left = this.item.refs.x + 'px';
2141
- itemElement.style.top = this.item.refs.y + 'px';
2142
- itemElement.style.width = this.item.refs.width + 'px';
2143
- if (this.item.type === exports.GanttItemType.bar) {
2144
- itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2145
- }
2146
- else if (this.item.type === exports.GanttItemType.range) {
2147
- itemElement.style.height = rangeHeight + 'px';
2016
+ Object.defineProperty(GanttCalendarComponent.prototype, "view", {
2017
+ get: function () {
2018
+ return this.ganttUpper.view;
2019
+ },
2020
+ enumerable: false,
2021
+ configurable: true
2022
+ });
2023
+ GanttCalendarComponent.prototype.setTodayPoint = function () {
2024
+ var x = this.view.getTodayXPoint();
2025
+ var today = new GanttDate().getDate();
2026
+ var todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
2027
+ var rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
2028
+ var line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
2029
+ if (isNumber(x)) {
2030
+ if (rect) {
2031
+ rect.style.left = x - todayWidth / 2 + "px";
2032
+ rect.style.top = headerHeight - todayHeight + "px";
2033
+ rect.innerHTML = today.toString();
2034
+ }
2035
+ if (line) {
2036
+ line.style.left = x + "px";
2037
+ line.style.top = headerHeight + "px";
2038
+ line.style.bottom = -mainHeight + "px";
2039
+ }
2148
2040
  }
2149
2041
  else {
2042
+ todayEle.style.display = 'none';
2150
2043
  }
2151
2044
  };
2152
- GanttItemUpper.prototype.onDestroy = function () {
2153
- this.unsubscribe$.next();
2154
- this.unsubscribe$.complete();
2155
- };
2156
- return GanttItemUpper;
2157
- }());
2158
- GanttItemUpper.decorators = [
2159
- { type: core.Directive }
2160
- ];
2161
- GanttItemUpper.ctorParameters = function () { return [
2162
- { type: core.ElementRef },
2163
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] }
2164
- ]; };
2165
- GanttItemUpper.propDecorators = {
2166
- template: [{ type: core.Input }],
2167
- item: [{ type: core.Input }]
2168
- };
2169
-
2170
- function linearGradient(sideOrCorner, color, stop) {
2171
- return "linear-gradient(" + sideOrCorner + "," + color + " 0%," + stop + " 40%)";
2172
- }
2173
- var NgxGanttBarComponent = /** @class */ (function (_super) {
2174
- __extends(NgxGanttBarComponent, _super);
2175
- function NgxGanttBarComponent(dragContainer, drag, elementRef, ganttUpper) {
2176
- var _this = _super.call(this, elementRef, ganttUpper) || this;
2177
- _this.dragContainer = dragContainer;
2178
- _this.drag = drag;
2179
- _this.ganttUpper = ganttUpper;
2180
- _this.barClick = new core.EventEmitter();
2181
- _this.ganttItemClass = true;
2182
- _this.color = 'red';
2183
- return _this;
2184
- }
2185
- NgxGanttBarComponent.prototype.ngOnInit = function () {
2045
+ GanttCalendarComponent.prototype.ngOnInit = function () {
2186
2046
  var _this = this;
2187
- _super.prototype.onInit.call(this);
2188
- this.dragContainer.dragEnded.pipe(operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2189
- _this.setContentBackground();
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
+ });
2190
2053
  });
2191
2054
  };
2192
- NgxGanttBarComponent.prototype.ngAfterViewInit = function () {
2193
- this.drag.createDrags(this.elementRef, this.item, this.ganttUpper);
2194
- this.setContentBackground();
2195
- };
2196
- NgxGanttBarComponent.prototype.ngOnChanges = function () {
2197
- _super.prototype.onChanges.call(this);
2198
- };
2199
- NgxGanttBarComponent.prototype.onBarClick = function (event) {
2200
- this.barClick.emit({ event: event, item: this.item.origin });
2201
- };
2202
- NgxGanttBarComponent.prototype.setContentBackground = function () {
2203
- var contentElement = this.contentElementRef.nativeElement;
2204
- var color = this.item.color || barBackground;
2205
- var style = this.item.barStyle || {};
2206
- if (this.item.origin.start && this.item.origin.end) {
2207
- style.background = color;
2208
- style.borderRadius = '';
2209
- }
2210
- if (this.item.origin.start && !this.item.origin.end) {
2211
- style.background = linearGradient('to left', hexToRgb(color, 0.55), hexToRgb(color, 1));
2212
- style.borderRadius = '4px 12.5px 12.5px 4px';
2213
- }
2214
- if (!this.item.origin.start && this.item.origin.end) {
2215
- style.background = linearGradient('to right', hexToRgb(color, 0.55), hexToRgb(color, 1));
2216
- style.borderRadius = '12.5px 4px 4px 12.5px';
2217
- }
2218
- if (this.item.progress >= 0) {
2219
- var contentProgressElement = contentElement.querySelector('.gantt-bar-content-progress');
2220
- style.background = hexToRgb(color, 0.3);
2221
- style.borderRadius = '';
2222
- contentProgressElement.style.background = color;
2223
- }
2224
- for (var key in style) {
2225
- if (style.hasOwnProperty(key)) {
2226
- contentElement.style[key] = style[key];
2227
- }
2228
- }
2229
- };
2230
- NgxGanttBarComponent.prototype.stopPropagation = function (event) {
2231
- event.stopPropagation();
2232
- };
2233
- NgxGanttBarComponent.prototype.ngOnDestroy = function () {
2234
- _super.prototype.onDestroy.call(this);
2055
+ GanttCalendarComponent.prototype.ngAfterViewInit = function () { };
2056
+ GanttCalendarComponent.prototype.ngOnChanges = function (changes) { };
2057
+ GanttCalendarComponent.prototype.trackBy = function (point, index) {
2058
+ return point.text || index;
2235
2059
  };
2236
- return NgxGanttBarComponent;
2237
- }(GanttItemUpper));
2238
- NgxGanttBarComponent.decorators = [
2239
- { type: core.Component, args: [{
2240
- selector: 'ngx-gantt-bar,gantt-bar',
2241
- 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",
2242
- providers: [GanttBarDrag]
2243
- },] }
2244
- ];
2245
- NgxGanttBarComponent.ctorParameters = function () { return [
2246
- { type: GanttDragContainer },
2247
- { type: GanttBarDrag },
2248
- { type: core.ElementRef },
2249
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] }
2250
- ]; };
2251
- NgxGanttBarComponent.propDecorators = {
2252
- barClick: [{ type: core.Output }],
2253
- contentElementRef: [{ type: core.ViewChild, args: ['content',] }],
2254
- ganttItemClass: [{ type: core.HostBinding, args: ['class.gantt-bar',] }]
2255
- };
2256
-
2257
- var GanttMainComponent = /** @class */ (function () {
2258
- function GanttMainComponent(ganttUpper) {
2259
- this.ganttUpper = ganttUpper;
2260
- this.barClick = new core.EventEmitter();
2261
- this.lineClick = new core.EventEmitter();
2262
- this.ganttMainClass = true;
2263
- }
2264
- GanttMainComponent.prototype.ngOnInit = function () { };
2265
- GanttMainComponent.prototype.trackBy = function (item, index) {
2266
- return item.id || index;
2060
+ GanttCalendarComponent.prototype.ngOnDestroy = function () {
2061
+ this.unsubscribe$.next();
2062
+ this.unsubscribe$.complete();
2267
2063
  };
2268
- return GanttMainComponent;
2064
+ return GanttCalendarComponent;
2269
2065
  }());
2270
- GanttMainComponent.decorators = [
2271
- { type: core.Component, args: [{
2272
- selector: 'gantt-main',
2273
- 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"
2274
- },] }
2275
- ];
2276
- GanttMainComponent.ctorParameters = function () { return [
2277
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] }
2278
- ]; };
2279
- GanttMainComponent.propDecorators = {
2280
- groups: [{ type: core.Input }],
2281
- items: [{ type: core.Input }],
2282
- groupHeaderTemplate: [{ type: core.Input }],
2283
- itemTemplate: [{ type: core.Input }],
2284
- barTemplate: [{ type: core.Input }],
2285
- rangeTemplate: [{ type: core.Input }],
2286
- barClick: [{ type: core.Output }],
2287
- lineClick: [{ type: core.Output }],
2288
- ganttMainClass: [{ type: core.HostBinding, args: ['class.gantt-main-container',] }]
2289
- };
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: [{
2069
+ type: i0.Component,
2070
+ args: [{
2071
+ selector: 'gantt-calendar-overlay',
2072
+ templateUrl: './calendar.component.html'
2073
+ }]
2074
+ }], ctorParameters: function () {
2075
+ return [{ type: GanttUpper, decorators: [{
2076
+ type: i0.Inject,
2077
+ args: [GANTT_UPPER_TOKEN]
2078
+ }] }, { type: i0__namespace.NgZone }, { type: i0__namespace.ElementRef }];
2079
+ }, propDecorators: { className: [{
2080
+ type: i0.HostBinding,
2081
+ args: ['class.gantt-calendar-overlay']
2082
+ }] } });
2290
2083
 
2291
- 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>";
2292
- 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>";
2293
- 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>";
2294
- 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>";
2295
- 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>";
2296
- 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>";
2297
- var icons = {
2298
- 'angle-right': angleRight,
2299
- 'angle-down': angleDown,
2300
- 'plus-square': plusSquare,
2301
- 'minus-square': minusSquare,
2302
- loading: loadingIcon,
2303
- empty: emptyIcon
2304
- };
2084
+ var GanttDragBackdropComponent = /** @class */ (function () {
2085
+ function GanttDragBackdropComponent() {
2086
+ this.backdropClass = true;
2087
+ }
2088
+ GanttDragBackdropComponent.prototype.ngOnInit = function () { };
2089
+ return GanttDragBackdropComponent;
2090
+ }());
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: [{
2094
+ type: i0.Component,
2095
+ args: [{
2096
+ selector: 'gantt-drag-backdrop',
2097
+ templateUrl: "./drag-backdrop.component.html"
2098
+ }]
2099
+ }], ctorParameters: function () { return []; }, propDecorators: { backdropClass: [{
2100
+ type: i0.HostBinding,
2101
+ args: ['class.gantt-drag-backdrop']
2102
+ }] } });
2305
2103
 
2306
- var GanttIconComponent = /** @class */ (function () {
2307
- function GanttIconComponent(elementRef) {
2104
+ var NgxGanttRootComponent = /** @class */ (function () {
2105
+ function NgxGanttRootComponent(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
2308
2106
  this.elementRef = elementRef;
2309
- this.isIcon = true;
2107
+ this.ngZone = ngZone;
2108
+ this.dom = dom;
2109
+ this.dragContainer = dragContainer;
2110
+ this.ganttUpper = ganttUpper;
2111
+ this.printService = printService;
2112
+ this.ganttClass = true;
2113
+ this.unsubscribe$ = new rxjs.Subject();
2114
+ this.ganttUpper.dragContainer = dragContainer;
2310
2115
  }
2311
- Object.defineProperty(GanttIconComponent.prototype, "iconName", {
2312
- set: function (name) {
2313
- this.setSvg(name);
2116
+ Object.defineProperty(NgxGanttRootComponent.prototype, "view", {
2117
+ get: function () {
2118
+ return this.ganttUpper.view;
2314
2119
  },
2315
2120
  enumerable: false,
2316
2121
  configurable: true
2317
2122
  });
2318
- GanttIconComponent.prototype.ngOnInit = function () { };
2319
- GanttIconComponent.prototype.ngAfterViewInit = function () { };
2320
- GanttIconComponent.prototype.setSvg = function (name) {
2321
- var iconSvg = icons[name];
2322
- if (iconSvg) {
2323
- this.elementRef.nativeElement.innerHTML = iconSvg;
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);
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;
2144
+ }
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
+ });
2167
+ };
2168
+ NgxGanttRootComponent.prototype.setupResize = function () {
2169
+ var _this = this;
2170
+ this.dom
2171
+ .getResize()
2172
+ .pipe(operators.takeUntil(this.unsubscribe$))
2173
+ .subscribe(function () {
2174
+ _this.setupScrollClass();
2175
+ });
2176
+ };
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';
2324
2183
  }
2325
2184
  else {
2326
- this.elementRef.nativeElement.innerHTML = '';
2185
+ this.elementRef.nativeElement.className = 'gantt';
2327
2186
  }
2328
2187
  };
2329
- return GanttIconComponent;
2330
- }());
2331
- GanttIconComponent.decorators = [
2332
- { type: core.Component, args: [{
2333
- selector: 'gantt-icon',
2334
- template: ''
2335
- },] }
2336
- ];
2337
- GanttIconComponent.ctorParameters = function () { return [
2338
- { type: core.ElementRef }
2339
- ]; };
2340
- GanttIconComponent.propDecorators = {
2341
- isIcon: [{ type: core.HostBinding, args: ['class.gantt-icon',] }],
2342
- iconName: [{ type: core.Input }]
2343
- };
2344
-
2345
- var GanttDragBackdropComponent = /** @class */ (function () {
2346
- function GanttDragBackdropComponent() {
2347
- this.backdropClass = true;
2348
- }
2349
- GanttDragBackdropComponent.prototype.ngOnInit = function () { };
2350
- return GanttDragBackdropComponent;
2188
+ NgxGanttRootComponent.prototype.scrollToToday = function () {
2189
+ var x = this.view.getTodayXPoint();
2190
+ this.dom.scrollMainContainer(x);
2191
+ };
2192
+ return NgxGanttRootComponent;
2351
2193
  }());
2352
- GanttDragBackdropComponent.decorators = [
2353
- { type: core.Component, args: [{
2354
- selector: 'gantt-drag-backdrop',
2355
- 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"
2356
- },] }
2357
- ];
2358
- GanttDragBackdropComponent.ctorParameters = function () { return []; };
2359
- GanttDragBackdropComponent.propDecorators = {
2360
- backdropClass: [{ type: core.HostBinding, args: ['class.gantt-drag-backdrop',] }]
2361
- };
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: [{
2197
+ type: i0.Component,
2198
+ args: [{
2199
+ selector: 'ngx-gantt-root',
2200
+ templateUrl: './root.component.html',
2201
+ providers: [GanttDomService, GanttDragContainer]
2202
+ }]
2203
+ }], ctorParameters: function () {
2204
+ return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
2205
+ type: i0.Inject,
2206
+ args: [GANTT_UPPER_TOKEN]
2207
+ }] }, { type: GanttPrintService, decorators: [{
2208
+ type: i0.Optional
2209
+ }] }];
2210
+ }, propDecorators: { sideWidth: [{
2211
+ type: i0.Input
2212
+ }], ganttClass: [{
2213
+ type: i0.HostBinding,
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 }]
2221
+ }] } });
2362
2222
 
2363
2223
  var LinkColors;
2364
2224
  (function (LinkColors) {
@@ -2374,7 +2234,7 @@
2374
2234
  this.ganttDragContainer = ganttDragContainer;
2375
2235
  this.groups = [];
2376
2236
  this.items = [];
2377
- this.lineClick = new core.EventEmitter();
2237
+ this.lineClick = new i0.EventEmitter();
2378
2238
  this.links = [];
2379
2239
  this.linkItems = [];
2380
2240
  this.bezierWeight = -0.5;
@@ -2524,364 +2384,726 @@
2524
2384
  };
2525
2385
  return GanttLinksComponent;
2526
2386
  }());
2527
- GanttLinksComponent.decorators = [
2528
- { type: core.Component, args: [{
2529
- selector: 'gantt-links-overlay',
2530
- 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"
2531
- },] }
2532
- ];
2533
- GanttLinksComponent.ctorParameters = function () { return [
2534
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] },
2535
- { type: core.ChangeDetectorRef },
2536
- { type: core.ElementRef },
2537
- { type: GanttDragContainer }
2538
- ]; };
2539
- GanttLinksComponent.propDecorators = {
2540
- groups: [{ type: core.Input }],
2541
- items: [{ type: core.Input }],
2542
- lineClick: [{ type: core.Output }],
2543
- ganttLinksOverlay: [{ type: core.HostBinding, args: ['class.gantt-links-overlay',] }]
2544
- };
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 });
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"] }] });
2389
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttLinksComponent, decorators: [{
2390
+ type: i0.Component,
2391
+ args: [{
2392
+ selector: 'gantt-links-overlay',
2393
+ templateUrl: './links.component.html'
2394
+ }]
2395
+ }], ctorParameters: function () {
2396
+ return [{ type: GanttUpper, decorators: [{
2397
+ type: i0.Inject,
2398
+ args: [GANTT_UPPER_TOKEN]
2399
+ }] }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.ElementRef }, { type: GanttDragContainer }];
2400
+ }, propDecorators: { groups: [{
2401
+ type: i0.Input
2402
+ }], items: [{
2403
+ type: i0.Input
2404
+ }], lineClick: [{
2405
+ type: i0.Output
2406
+ }], ganttLinksOverlay: [{
2407
+ type: i0.HostBinding,
2408
+ args: ['class.gantt-links-overlay']
2409
+ }] } });
2545
2410
 
2546
- var GanttPrintService = /** @class */ (function () {
2547
- function GanttPrintService() {
2411
+ var GanttItemUpper = /** @class */ (function () {
2412
+ function GanttItemUpper(elementRef, ganttUpper) {
2413
+ this.elementRef = elementRef;
2414
+ this.ganttUpper = ganttUpper;
2415
+ this.firstChange = true;
2416
+ this.unsubscribe$ = new rxjs.Subject();
2548
2417
  }
2549
- GanttPrintService.prototype.setInlineStyles = function (targetElem) {
2550
- var e_1, _a;
2551
- var svgElements = Array.from(targetElem.getElementsByTagName('svg'));
2552
- try {
2553
- for (var svgElements_1 = __values(svgElements), svgElements_1_1 = svgElements_1.next(); !svgElements_1_1.done; svgElements_1_1 = svgElements_1.next()) {
2554
- var svgElement = svgElements_1_1.value;
2555
- this.recursElementChildren(svgElement);
2556
- }
2557
- }
2558
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2559
- finally {
2560
- try {
2561
- if (svgElements_1_1 && !svgElements_1_1.done && (_a = svgElements_1.return)) _a.call(svgElements_1);
2562
- }
2563
- finally { if (e_1) throw e_1.error; }
2564
- }
2565
- };
2566
- GanttPrintService.prototype.recursElementChildren = function (node) {
2567
- var e_2, _a, e_3, _b;
2568
- var transformProperties = [
2569
- 'fill',
2570
- 'color',
2571
- 'font-size',
2572
- 'stroke',
2573
- 'font',
2574
- 'text-anchor',
2575
- 'stroke-dasharray',
2576
- 'shape-rendering',
2577
- 'stroke-width'
2578
- ];
2579
- if (!node.style) {
2580
- return;
2581
- }
2582
- var styles = getComputedStyle(node);
2583
- try {
2584
- for (var transformProperties_1 = __values(transformProperties), transformProperties_1_1 = transformProperties_1.next(); !transformProperties_1_1.done; transformProperties_1_1 = transformProperties_1.next()) {
2585
- var transformProperty = transformProperties_1_1.value;
2586
- node.style[transformProperty] = styles[transformProperty];
2587
- }
2588
- }
2589
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2590
- finally {
2591
- try {
2592
- if (transformProperties_1_1 && !transformProperties_1_1.done && (_a = transformProperties_1.return)) _a.call(transformProperties_1);
2593
- }
2594
- finally { if (e_2) throw e_2.error; }
2595
- }
2596
- try {
2597
- for (var _c = __values(Array.from(node.childNodes)), _d = _c.next(); !_d.done; _d = _c.next()) {
2598
- var child = _d.value;
2599
- this.recursElementChildren(child);
2600
- }
2601
- }
2602
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
2603
- finally {
2604
- try {
2605
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2606
- }
2607
- finally { if (e_3) throw e_3.error; }
2608
- }
2609
- };
2610
- GanttPrintService.prototype.register = function (root) {
2611
- this.root = root.nativeElement;
2612
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
2613
- };
2614
- GanttPrintService.prototype.print = function (name, ignoreElementClass) {
2418
+ GanttItemUpper.prototype.onInit = function () {
2615
2419
  var _this = this;
2616
- if (name === void 0) { name = 'download'; }
2617
- var root = this.root;
2618
- var mainContainer = this.mainContainer;
2619
- // set print width
2620
- var printWidth = root.offsetWidth;
2621
- // set print height
2622
- var printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
2623
- html2canvas__default['default'](root, {
2624
- logging: false,
2625
- allowTaint: true,
2626
- useCORS: true,
2627
- width: printWidth,
2628
- height: printHeight,
2629
- ignoreElements: function (element) {
2630
- if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
2631
- return true;
2632
- }
2633
- if (element.classList.contains('gantt-calendar-today-overlay')) {
2634
- return true;
2635
- }
2636
- },
2637
- onclone: function (cloneDocument) {
2638
- var ganttClass = root.className;
2639
- var cloneGanttDom = cloneDocument.querySelector("." + ganttClass.replace(/\s+/g, '.'));
2640
- var cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
2641
- var cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
2642
- var cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
2643
- // change targetDom width
2644
- cloneGanttDom.style.width = printWidth + "px";
2645
- cloneGanttDom.style.height = printHeight + "px";
2646
- cloneGanttDom.style.overflow = "unset";
2647
- cloneGanttContainerDom.style.backgroundColor = '#fff';
2648
- cloneCalendarOverlay.setAttribute('height', "" + printHeight);
2649
- cloneCalendarOverlay.setAttribute('style', "background: transparent");
2650
- if (cloneLinksOverlay) {
2651
- cloneLinksOverlay.setAttribute('height', "" + printHeight);
2652
- cloneLinksOverlay.setAttribute('style', "height: " + printHeight + "px");
2653
- }
2654
- // setInlineStyles for svg
2655
- _this.setInlineStyles(cloneGanttDom);
2656
- }
2657
- }).then(function (canvas) {
2658
- var link = document.createElement('a');
2659
- var dataUrl = canvas.toDataURL('image/png');
2660
- link.download = name + ".png";
2661
- link.href = dataUrl;
2662
- link.click();
2420
+ this.firstChange = false;
2421
+ this.item.refs$.pipe(operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2422
+ _this.setPositions();
2663
2423
  });
2664
2424
  };
2665
- return GanttPrintService;
2425
+ GanttItemUpper.prototype.onChanges = function () {
2426
+ if (!this.firstChange) {
2427
+ this.setPositions();
2428
+ }
2429
+ };
2430
+ GanttItemUpper.prototype.setPositions = function () {
2431
+ var itemElement = this.elementRef.nativeElement;
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';
2435
+ if (this.item.type === exports.GanttItemType.bar) {
2436
+ itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2437
+ }
2438
+ else if (this.item.type === exports.GanttItemType.range) {
2439
+ itemElement.style.height = rangeHeight + 'px';
2440
+ }
2441
+ else {
2442
+ }
2443
+ };
2444
+ GanttItemUpper.prototype.onDestroy = function () {
2445
+ this.unsubscribe$.next();
2446
+ this.unsubscribe$.complete();
2447
+ };
2448
+ return GanttItemUpper;
2666
2449
  }());
2667
- GanttPrintService.decorators = [
2668
- { type: core.Injectable }
2669
- ];
2670
- GanttPrintService.ctorParameters = function () { return []; };
2450
+ GanttItemUpper.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttItemUpper, deps: [{ token: i0__namespace.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Directive });
2451
+ GanttItemUpper.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.2", type: GanttItemUpper, inputs: { template: "template", item: "item" }, ngImport: i0__namespace });
2452
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttItemUpper, decorators: [{
2453
+ type: i0.Directive
2454
+ }], ctorParameters: function () {
2455
+ return [{ type: i0__namespace.ElementRef }, { type: GanttUpper, decorators: [{
2456
+ type: i0.Inject,
2457
+ args: [GANTT_UPPER_TOKEN]
2458
+ }] }];
2459
+ }, propDecorators: { template: [{
2460
+ type: i0.Input
2461
+ }], item: [{
2462
+ type: i0.Input
2463
+ }] } });
2671
2464
 
2672
- var NgxGanttRootComponent = /** @class */ (function () {
2673
- function NgxGanttRootComponent(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
2674
- this.elementRef = elementRef;
2675
- this.ngZone = ngZone;
2465
+ var NgxGanttRangeComponent = /** @class */ (function (_super) {
2466
+ __extends(NgxGanttRangeComponent, _super);
2467
+ function NgxGanttRangeComponent(elementRef, ganttUpper) {
2468
+ var _this = _super.call(this, elementRef, ganttUpper) || this;
2469
+ _this.ganttRangeClass = true;
2470
+ return _this;
2471
+ }
2472
+ NgxGanttRangeComponent.prototype.ngOnInit = function () {
2473
+ _super.prototype.onInit.call(this);
2474
+ };
2475
+ NgxGanttRangeComponent.prototype.ngOnChanges = function () {
2476
+ _super.prototype.onChanges.call(this);
2477
+ };
2478
+ NgxGanttRangeComponent.prototype.ngOnDestroy = function () {
2479
+ _super.prototype.onDestroy.call(this);
2480
+ };
2481
+ return NgxGanttRangeComponent;
2482
+ }(GanttItemUpper));
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 });
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"] }] });
2485
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttRangeComponent, decorators: [{
2486
+ type: i0.Component,
2487
+ args: [{
2488
+ selector: 'ngx-gantt-range,gantt-range',
2489
+ templateUrl: './range.component.html'
2490
+ }]
2491
+ }], ctorParameters: function () {
2492
+ return [{ type: i0__namespace.ElementRef }, { type: GanttUpper, decorators: [{
2493
+ type: i0.Inject,
2494
+ args: [GANTT_UPPER_TOKEN]
2495
+ }] }];
2496
+ }, propDecorators: { ganttRangeClass: [{
2497
+ type: i0.HostBinding,
2498
+ args: ['class.gantt-range']
2499
+ }] } });
2500
+
2501
+ var dragMinWidth = 10;
2502
+ var activeClass = 'gantt-bar-active';
2503
+ var linkDropClass = 'gantt-bar-link-drop';
2504
+ function createSvgElement(qualifiedName, className) {
2505
+ var element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
2506
+ element.classList.add(className);
2507
+ return element;
2508
+ }
2509
+ var GanttBarDrag = /** @class */ (function () {
2510
+ function GanttBarDrag(dragDrop, dom, dragContainer) {
2511
+ this.dragDrop = dragDrop;
2676
2512
  this.dom = dom;
2677
2513
  this.dragContainer = dragContainer;
2678
- this.ganttUpper = ganttUpper;
2679
- this.printService = printService;
2680
- this.ganttClass = true;
2681
- this.unsubscribe$ = new rxjs.Subject();
2682
- this.ganttUpper.dragContainer = dragContainer;
2514
+ this.dragRefs = [];
2515
+ this.destroy$ = new rxjs.Subject();
2683
2516
  }
2684
- Object.defineProperty(NgxGanttRootComponent.prototype, "view", {
2517
+ Object.defineProperty(GanttBarDrag.prototype, "dragDisabled", {
2685
2518
  get: function () {
2686
- return this.ganttUpper.view;
2519
+ return !this.item.draggable || !this.ganttUpper.draggable;
2687
2520
  },
2688
2521
  enumerable: false,
2689
2522
  configurable: true
2690
2523
  });
2691
- NgxGanttRootComponent.prototype.ngOnInit = function () {
2524
+ Object.defineProperty(GanttBarDrag.prototype, "linkDragDisabled", {
2525
+ get: function () {
2526
+ return !this.item.linkable || !this.ganttUpper.linkable;
2527
+ },
2528
+ enumerable: false,
2529
+ configurable: true
2530
+ });
2531
+ GanttBarDrag.prototype.createMouseEvents = function () {
2692
2532
  var _this = this;
2693
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
2694
- _this.dom.initialize(_this.elementRef);
2695
- if (_this.printService) {
2696
- _this.printService.register(_this.elementRef);
2533
+ rxjs.fromEvent(this.barElement, 'mouseenter')
2534
+ .pipe(operators.takeUntil(this.destroy$))
2535
+ .subscribe(function () {
2536
+ if (_this.dragContainer.linkDraggingId && _this.dragContainer.linkDraggingId !== _this.item.id) {
2537
+ if (_this.item.linkable) {
2538
+ _this.barElement.classList.add(linkDropClass);
2539
+ _this.dragContainer.emitLinkDragEntered(_this.item);
2540
+ }
2697
2541
  }
2698
- _this.setupScrollClass();
2699
- _this.setupResize();
2700
- _this.setupViewScroll();
2701
- // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2702
- _this.elementRef.nativeElement.style.opacity = '1';
2703
- _this.ganttUpper.viewChange.pipe(operators.startWith(null)).subscribe(function () {
2704
- _this.scrollToToday();
2542
+ else {
2543
+ _this.barElement.classList.add(activeClass);
2544
+ }
2545
+ });
2546
+ rxjs.fromEvent(this.barElement, 'mouseleave')
2547
+ .pipe(operators.takeUntil(this.destroy$))
2548
+ .subscribe(function () {
2549
+ if (!_this.dragContainer.linkDraggingId) {
2550
+ _this.barElement.classList.remove(activeClass);
2551
+ }
2552
+ else {
2553
+ _this.dragContainer.emitLinkDragLeaved();
2554
+ }
2555
+ _this.barElement.classList.remove(linkDropClass);
2556
+ });
2557
+ };
2558
+ GanttBarDrag.prototype.createBarDrag = function () {
2559
+ var _this = this;
2560
+ var dragRef = this.dragDrop.createDrag(this.barElement);
2561
+ dragRef.lockAxis = 'x';
2562
+ dragRef.started.subscribe(function () {
2563
+ _this.setDraggingStyles();
2564
+ _this.dragContainer.dragStarted.emit({ item: _this.item.origin });
2565
+ });
2566
+ dragRef.moved.subscribe(function (event) {
2567
+ var x = _this.item.refs.x + event.distance.x;
2568
+ var days = dateFns.differenceInCalendarDays(_this.item.end.value, _this.item.start.value);
2569
+ var start = _this.ganttUpper.view.getDateByXPoint(x);
2570
+ var end = start.addDays(days);
2571
+ _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), end);
2572
+ });
2573
+ dragRef.ended.subscribe(function (event) {
2574
+ var days = dateFns.differenceInCalendarDays(_this.item.end.value, _this.item.start.value);
2575
+ var start = _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + event.distance.x);
2576
+ var end = start.addDays(days);
2577
+ _this.item.updateDate(start, end);
2578
+ _this.clearDraggingStyles();
2579
+ _this.closeDragBackdrop();
2580
+ event.source.reset();
2581
+ _this.dragContainer.dragEnded.emit({ item: _this.item.origin });
2582
+ });
2583
+ this.barDragRef = dragRef;
2584
+ return dragRef;
2585
+ };
2586
+ GanttBarDrag.prototype.createBarHandleDrags = function () {
2587
+ var _this = this;
2588
+ var dragRefs = [];
2589
+ var handles = this.barElement.querySelectorAll('.drag-handles .handle');
2590
+ handles.forEach(function (handle, index) {
2591
+ var isBefore = index === 0;
2592
+ var dragRef = _this.dragDrop.createDrag(handle);
2593
+ dragRef.lockAxis = 'x';
2594
+ dragRef.withBoundaryElement(_this.dom.root);
2595
+ dragRef.started.subscribe(function () {
2596
+ _this.setDraggingStyles();
2597
+ _this.dragContainer.dragStarted.emit({ item: _this.item.origin });
2598
+ });
2599
+ dragRef.moved.subscribe(function (event) {
2600
+ if (isBefore) {
2601
+ var x = _this.item.refs.x + event.distance.x;
2602
+ var width = _this.item.refs.width + event.distance.x * -1;
2603
+ if (width > dragMinWidth) {
2604
+ _this.barElement.style.width = width + 'px';
2605
+ _this.barElement.style.left = x + 'px';
2606
+ _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), _this.ganttUpper.view.getDateByXPoint(x + width));
2607
+ }
2608
+ }
2609
+ else {
2610
+ var width = _this.item.refs.width + event.distance.x;
2611
+ if (width > dragMinWidth) {
2612
+ _this.barElement.style.width = width + 'px';
2613
+ _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x), _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + width));
2614
+ }
2615
+ }
2616
+ event.source.reset();
2617
+ });
2618
+ dragRef.ended.subscribe(function (event) {
2619
+ if (isBefore) {
2620
+ var width = _this.item.refs.width + event.distance.x * -1;
2621
+ if (width > dragMinWidth) {
2622
+ _this.item.updateDate(_this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + event.distance.x), _this.item.end);
2623
+ }
2624
+ else {
2625
+ _this.item.updateDate(_this.item.end.startOfDay(), _this.item.end);
2626
+ }
2627
+ }
2628
+ else {
2629
+ var width = _this.item.refs.width + event.distance.x;
2630
+ if (width > dragMinWidth) {
2631
+ _this.item.updateDate(_this.item.start, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + _this.item.refs.width + event.distance.x));
2632
+ }
2633
+ else {
2634
+ _this.item.updateDate(_this.item.start, _this.item.start.endOfDay());
2635
+ }
2636
+ }
2637
+ _this.clearDraggingStyles();
2638
+ _this.closeDragBackdrop();
2639
+ _this.dragContainer.dragEnded.emit({ item: _this.item.origin });
2640
+ });
2641
+ dragRefs.push(dragRef);
2642
+ });
2643
+ return dragRefs;
2644
+ };
2645
+ GanttBarDrag.prototype.createLinkHandleDrags = function () {
2646
+ var _this = this;
2647
+ var dragRefs = [];
2648
+ var handles = this.barElement.querySelectorAll('.link-handles .handle');
2649
+ handles.forEach(function (handle, index) {
2650
+ var isBefore = index === 0;
2651
+ var dragRef = _this.dragDrop.createDrag(handle);
2652
+ dragRef.withBoundaryElement(_this.dom.root);
2653
+ dragRef.beforeStarted.subscribe(function () {
2654
+ handle.style.pointerEvents = 'none';
2655
+ if (_this.barDragRef) {
2656
+ _this.barDragRef.disabled = true;
2657
+ }
2658
+ _this.createLinkDraggingLine();
2659
+ _this.dragContainer.emitLinkDragStarted(isBefore ? 'target' : 'source', _this.item);
2660
+ });
2661
+ dragRef.moved.subscribe(function () {
2662
+ var positions = _this.calcLinkLinePositions(handle, isBefore);
2663
+ _this.linkDraggingLine.setAttribute('x1', positions.x1.toString());
2664
+ _this.linkDraggingLine.setAttribute('y1', positions.y1.toString());
2665
+ _this.linkDraggingLine.setAttribute('x2', positions.x2.toString());
2666
+ _this.linkDraggingLine.setAttribute('y2', positions.y2.toString());
2667
+ });
2668
+ dragRef.ended.subscribe(function (event) {
2669
+ event.source.reset();
2670
+ handle.style.pointerEvents = '';
2671
+ if (_this.barDragRef) {
2672
+ _this.barDragRef.disabled = false;
2673
+ }
2674
+ _this.barElement.classList.remove(activeClass);
2675
+ _this.destroyLinkDraggingLine();
2676
+ _this.dragContainer.emitLinkDragEnded();
2705
2677
  });
2678
+ dragRefs.push(dragRef);
2706
2679
  });
2680
+ return dragRefs;
2681
+ };
2682
+ GanttBarDrag.prototype.openDragBackdrop = function (dragElement, start, end) {
2683
+ var dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
2684
+ var dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
2685
+ var rootRect = this.dom.root.getBoundingClientRect();
2686
+ var dragRect = dragElement.getBoundingClientRect();
2687
+ var left = dragRect.left - rootRect.left - this.dom.side.clientWidth;
2688
+ var width = dragRect.right - dragRect.left;
2689
+ dragMaskElement.style.left = left + 'px';
2690
+ dragMaskElement.style.width = width + 'px';
2691
+ dragMaskElement.querySelector('.start').innerHTML = start.format('MM-dd');
2692
+ dragMaskElement.querySelector('.end').innerHTML = end.format('MM-dd');
2693
+ dragMaskElement.style.display = 'block';
2694
+ dragBackdropElement.style.display = 'block';
2695
+ };
2696
+ GanttBarDrag.prototype.closeDragBackdrop = function () {
2697
+ var dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
2698
+ var dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
2699
+ dragMaskElement.style.display = 'none';
2700
+ dragBackdropElement.style.display = 'none';
2701
+ };
2702
+ GanttBarDrag.prototype.setDraggingStyles = function () {
2703
+ this.barElement.style.pointerEvents = 'none';
2704
+ this.barElement.classList.add('gantt-bar-draggable-drag');
2707
2705
  };
2708
- NgxGanttRootComponent.prototype.setupViewScroll = function () {
2709
- var _this = this;
2710
- if (this.ganttUpper.disabledLoadOnScroll) {
2711
- return;
2706
+ GanttBarDrag.prototype.clearDraggingStyles = function () {
2707
+ this.barElement.style.pointerEvents = '';
2708
+ this.barElement.classList.remove('gantt-bar-draggable-drag');
2709
+ };
2710
+ GanttBarDrag.prototype.calcLinkLinePositions = function (target, isBefore) {
2711
+ var rootRect = this.dom.root.getBoundingClientRect();
2712
+ var targetRect = target.getBoundingClientRect();
2713
+ var layerRect = target.parentElement.parentElement.getBoundingClientRect();
2714
+ return {
2715
+ x1: layerRect.left + (isBefore ? 0 : layerRect.width) - rootRect.left,
2716
+ y1: layerRect.top + layerRect.height / 2 - rootRect.top,
2717
+ x2: targetRect.left - rootRect.left + targetRect.width / 2,
2718
+ y2: targetRect.top - rootRect.top + targetRect.height / 2
2719
+ };
2720
+ };
2721
+ GanttBarDrag.prototype.createLinkDraggingLine = function () {
2722
+ if (!this.linkDraggingLine) {
2723
+ var svgElement = createSvgElement('svg', 'gantt-link-drag-container');
2724
+ var linElement = createSvgElement('line', 'link-dragging-line');
2725
+ svgElement.appendChild(linElement);
2726
+ this.dom.root.appendChild(svgElement);
2727
+ this.linkDraggingLine = linElement;
2712
2728
  }
2713
- this.dom
2714
- .getViewerScroll()
2715
- .pipe(operators.takeUntil(this.unsubscribe$))
2716
- .subscribe(function (event) {
2717
- if (event.direction === ScrollDirection.LEFT) {
2718
- var dates_1 = _this.view.addStartDate();
2719
- if (dates_1) {
2720
- event.target.scrollLeft += _this.view.getDateRangeWidth(dates_1.start, dates_1.end);
2721
- _this.ngZone.run(function () {
2722
- _this.ganttUpper.loadOnScroll.emit({ start: dates_1.start.getUnixTime(), end: dates_1.end.getUnixTime() });
2723
- });
2724
- }
2725
- }
2726
- if (event.direction === ScrollDirection.RIGHT) {
2727
- var dates_2 = _this.view.addEndDate();
2728
- if (dates_2) {
2729
- _this.ngZone.run(function () {
2730
- _this.ganttUpper.loadOnScroll.emit({ start: dates_2.start.getUnixTime(), end: dates_2.end.getUnixTime() });
2731
- });
2732
- }
2733
- }
2734
- });
2735
2729
  };
2736
- NgxGanttRootComponent.prototype.setupResize = function () {
2737
- var _this = this;
2738
- this.dom
2739
- .getResize()
2740
- .pipe(operators.takeUntil(this.unsubscribe$))
2741
- .subscribe(function () {
2742
- _this.setupScrollClass();
2743
- });
2730
+ GanttBarDrag.prototype.destroyLinkDraggingLine = function () {
2731
+ if (this.linkDraggingLine) {
2732
+ this.linkDraggingLine.parentElement.remove();
2733
+ this.linkDraggingLine = null;
2734
+ }
2744
2735
  };
2745
- NgxGanttRootComponent.prototype.setupScrollClass = function () {
2746
- var mainContainer = this.dom.mainContainer;
2747
- var height = mainContainer.offsetHeight;
2748
- var scrollHeight = mainContainer.scrollHeight;
2749
- if (scrollHeight > height) {
2750
- this.elementRef.nativeElement.className = 'gantt gantt-scroll';
2736
+ GanttBarDrag.prototype.createDrags = function (elementRef, item, ganttUpper) {
2737
+ var _a, _b;
2738
+ this.item = item;
2739
+ this.barElement = elementRef.nativeElement;
2740
+ this.ganttUpper = ganttUpper;
2741
+ if (!item.draggable || (this.dragDisabled && this.linkDragDisabled)) {
2742
+ return;
2751
2743
  }
2752
2744
  else {
2753
- this.elementRef.nativeElement.className = 'gantt';
2745
+ this.createMouseEvents();
2746
+ if (!this.dragDisabled) {
2747
+ var dragRef = this.createBarDrag();
2748
+ var dragHandlesRefs = this.createBarHandleDrags();
2749
+ (_a = this.dragRefs).push.apply(_a, __spreadArray([dragRef], __read(dragHandlesRefs)));
2750
+ }
2751
+ if (!this.linkDragDisabled) {
2752
+ var linkDragRefs = this.createLinkHandleDrags();
2753
+ (_b = this.dragRefs).push.apply(_b, __spreadArray([], __read(linkDragRefs)));
2754
+ }
2754
2755
  }
2755
2756
  };
2756
- NgxGanttRootComponent.prototype.scrollToToday = function () {
2757
- var x = this.view.getTodayXPoint();
2758
- this.dom.scrollMainContainer(x);
2757
+ GanttBarDrag.prototype.ngOnDestroy = function () {
2758
+ this.closeDragBackdrop();
2759
+ this.dragRefs.forEach(function (dragRef) { return dragRef.dispose(); });
2760
+ this.destroy$.next();
2761
+ this.destroy$.complete();
2759
2762
  };
2760
- return NgxGanttRootComponent;
2763
+ return GanttBarDrag;
2761
2764
  }());
2762
- NgxGanttRootComponent.decorators = [
2763
- { type: core.Component, args: [{
2764
- selector: 'ngx-gantt-root',
2765
- 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",
2766
- providers: [GanttDomService, GanttDragContainer]
2767
- },] }
2768
- ];
2769
- NgxGanttRootComponent.ctorParameters = function () { return [
2770
- { type: core.ElementRef },
2771
- { type: core.NgZone },
2772
- { type: GanttDomService },
2773
- { type: GanttDragContainer },
2774
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] },
2775
- { type: GanttPrintService, decorators: [{ type: core.Optional }] }
2776
- ]; };
2777
- NgxGanttRootComponent.propDecorators = {
2778
- sideWidth: [{ type: core.Input }],
2779
- ganttClass: [{ type: core.HostBinding, args: ['class.gantt',] }],
2780
- sideTemplate: [{ type: core.ContentChild, args: ['sideTemplate', { static: true },] }],
2781
- mainTemplate: [{ type: core.ContentChild, args: ['mainTemplate', { static: true },] }]
2782
- };
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 });
2766
+ GanttBarDrag.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttBarDrag });
2767
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttBarDrag, decorators: [{
2768
+ type: i0.Injectable
2769
+ }], ctorParameters: function () { return [{ type: i1__namespace.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }]; } });
2783
2770
 
2784
- var NgxGanttRangeComponent = /** @class */ (function (_super) {
2785
- __extends(NgxGanttRangeComponent, _super);
2786
- function NgxGanttRangeComponent(elementRef, ganttUpper) {
2771
+ function linearGradient(sideOrCorner, color, stop) {
2772
+ return "linear-gradient(" + sideOrCorner + "," + color + " 0%," + stop + " 40%)";
2773
+ }
2774
+ var NgxGanttBarComponent = /** @class */ (function (_super) {
2775
+ __extends(NgxGanttBarComponent, _super);
2776
+ function NgxGanttBarComponent(dragContainer, drag, elementRef, ganttUpper) {
2787
2777
  var _this = _super.call(this, elementRef, ganttUpper) || this;
2788
- _this.ganttRangeClass = true;
2778
+ _this.dragContainer = dragContainer;
2779
+ _this.drag = drag;
2780
+ _this.ganttUpper = ganttUpper;
2781
+ _this.barClick = new i0.EventEmitter();
2782
+ _this.ganttItemClass = true;
2783
+ _this.color = 'red';
2789
2784
  return _this;
2790
2785
  }
2791
- NgxGanttRangeComponent.prototype.ngOnInit = function () {
2786
+ NgxGanttBarComponent.prototype.ngOnInit = function () {
2787
+ var _this = this;
2792
2788
  _super.prototype.onInit.call(this);
2789
+ this.dragContainer.dragEnded.pipe(operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2790
+ _this.setContentBackground();
2791
+ });
2793
2792
  };
2794
- NgxGanttRangeComponent.prototype.ngOnChanges = function () {
2793
+ NgxGanttBarComponent.prototype.ngAfterViewInit = function () {
2794
+ this.drag.createDrags(this.elementRef, this.item, this.ganttUpper);
2795
+ this.setContentBackground();
2796
+ };
2797
+ NgxGanttBarComponent.prototype.ngOnChanges = function () {
2795
2798
  _super.prototype.onChanges.call(this);
2796
2799
  };
2797
- NgxGanttRangeComponent.prototype.ngOnDestroy = function () {
2800
+ NgxGanttBarComponent.prototype.onBarClick = function (event) {
2801
+ this.barClick.emit({ event: event, item: this.item.origin });
2802
+ };
2803
+ NgxGanttBarComponent.prototype.setContentBackground = function () {
2804
+ var contentElement = this.contentElementRef.nativeElement;
2805
+ var color = this.item.color || barBackground;
2806
+ var style = this.item.barStyle || {};
2807
+ if (this.item.origin.start && this.item.origin.end) {
2808
+ style.background = color;
2809
+ style.borderRadius = '';
2810
+ }
2811
+ if (this.item.origin.start && !this.item.origin.end) {
2812
+ style.background = linearGradient('to left', hexToRgb(color, 0.55), hexToRgb(color, 1));
2813
+ style.borderRadius = '4px 12.5px 12.5px 4px';
2814
+ }
2815
+ if (!this.item.origin.start && this.item.origin.end) {
2816
+ style.background = linearGradient('to right', hexToRgb(color, 0.55), hexToRgb(color, 1));
2817
+ style.borderRadius = '12.5px 4px 4px 12.5px';
2818
+ }
2819
+ if (this.item.progress >= 0) {
2820
+ var contentProgressElement = contentElement.querySelector('.gantt-bar-content-progress');
2821
+ style.background = hexToRgb(color, 0.3);
2822
+ style.borderRadius = '';
2823
+ contentProgressElement.style.background = color;
2824
+ }
2825
+ for (var key in style) {
2826
+ if (style.hasOwnProperty(key)) {
2827
+ contentElement.style[key] = style[key];
2828
+ }
2829
+ }
2830
+ };
2831
+ NgxGanttBarComponent.prototype.stopPropagation = function (event) {
2832
+ event.stopPropagation();
2833
+ };
2834
+ NgxGanttBarComponent.prototype.ngOnDestroy = function () {
2798
2835
  _super.prototype.onDestroy.call(this);
2799
2836
  };
2800
- return NgxGanttRangeComponent;
2837
+ return NgxGanttBarComponent;
2801
2838
  }(GanttItemUpper));
2802
- NgxGanttRangeComponent.decorators = [
2803
- { type: core.Component, args: [{
2804
- selector: 'ngx-gantt-range,gantt-range',
2805
- 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"
2806
- },] }
2807
- ];
2808
- NgxGanttRangeComponent.ctorParameters = function () { return [
2809
- { type: core.ElementRef },
2810
- { type: GanttUpper, decorators: [{ type: core.Inject, args: [GANTT_UPPER_TOKEN,] }] }
2811
- ]; };
2812
- NgxGanttRangeComponent.propDecorators = {
2813
- ganttRangeClass: [{ type: core.HostBinding, args: ['class.gantt-range',] }]
2814
- };
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 });
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"] }] });
2841
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttBarComponent, decorators: [{
2842
+ type: i0.Component,
2843
+ args: [{
2844
+ selector: 'ngx-gantt-bar,gantt-bar',
2845
+ templateUrl: './bar.component.html',
2846
+ providers: [GanttBarDrag]
2847
+ }]
2848
+ }], ctorParameters: function () {
2849
+ return [{ type: GanttDragContainer }, { type: GanttBarDrag }, { type: i0__namespace.ElementRef }, { type: GanttUpper, decorators: [{
2850
+ type: i0.Inject,
2851
+ args: [GANTT_UPPER_TOKEN]
2852
+ }] }];
2853
+ }, propDecorators: { barClick: [{
2854
+ type: i0.Output
2855
+ }], contentElementRef: [{
2856
+ type: i0.ViewChild,
2857
+ args: ['content']
2858
+ }], ganttItemClass: [{
2859
+ type: i0.HostBinding,
2860
+ args: ['class.gantt-bar']
2861
+ }] } });
2815
2862
 
2816
- var IsGanttRangeItemPipe = /** @class */ (function () {
2817
- function IsGanttRangeItemPipe() {
2863
+ var GanttMainComponent = /** @class */ (function () {
2864
+ function GanttMainComponent(ganttUpper) {
2865
+ this.ganttUpper = ganttUpper;
2866
+ this.barClick = new i0.EventEmitter();
2867
+ this.lineClick = new i0.EventEmitter();
2868
+ this.ganttMainClass = true;
2818
2869
  }
2819
- IsGanttRangeItemPipe.prototype.transform = function (value) {
2820
- return value === exports.GanttItemType.range;
2870
+ GanttMainComponent.prototype.ngOnInit = function () { };
2871
+ GanttMainComponent.prototype.trackBy = function (item, index) {
2872
+ return item.id || index;
2821
2873
  };
2822
- return IsGanttRangeItemPipe;
2874
+ return GanttMainComponent;
2823
2875
  }());
2824
- IsGanttRangeItemPipe.decorators = [
2825
- { type: core.Pipe, args: [{
2826
- name: 'isGanttRangeItem'
2827
- },] }
2828
- ];
2829
- var IsGanttBarItemPipe = /** @class */ (function () {
2830
- function IsGanttBarItemPipe() {
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 });
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 } });
2878
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttMainComponent, decorators: [{
2879
+ type: i0.Component,
2880
+ args: [{
2881
+ selector: 'gantt-main',
2882
+ templateUrl: './gantt-main.component.html'
2883
+ }]
2884
+ }], ctorParameters: function () {
2885
+ return [{ type: GanttUpper, decorators: [{
2886
+ type: i0.Inject,
2887
+ args: [GANTT_UPPER_TOKEN]
2888
+ }] }];
2889
+ }, propDecorators: { groups: [{
2890
+ type: i0.Input
2891
+ }], items: [{
2892
+ type: i0.Input
2893
+ }], groupHeaderTemplate: [{
2894
+ type: i0.Input
2895
+ }], itemTemplate: [{
2896
+ type: i0.Input
2897
+ }], barTemplate: [{
2898
+ type: i0.Input
2899
+ }], rangeTemplate: [{
2900
+ type: i0.Input
2901
+ }], barClick: [{
2902
+ type: i0.Output
2903
+ }], lineClick: [{
2904
+ type: i0.Output
2905
+ }], ganttMainClass: [{
2906
+ type: i0.HostBinding,
2907
+ args: ['class.gantt-main-container']
2908
+ }] } });
2909
+
2910
+ var NgxGanttComponent = /** @class */ (function (_super) {
2911
+ __extends(NgxGanttComponent, _super);
2912
+ function NgxGanttComponent(elementRef, cdr, ngZone, config) {
2913
+ var _this = _super.call(this, elementRef, cdr, ngZone, config) || this;
2914
+ _this.maxLevel = 2;
2915
+ _this.linkDragStarted = new i0.EventEmitter();
2916
+ _this.linkDragEnded = new i0.EventEmitter();
2917
+ _this.lineClick = new i0.EventEmitter();
2918
+ _this.ngUnsubscribe$ = new rxjs.Subject();
2919
+ _this.sideTableWidth = sideWidth;
2920
+ return _this;
2831
2921
  }
2832
- IsGanttBarItemPipe.prototype.transform = function (value) {
2833
- return value === exports.GanttItemType.bar;
2922
+ NgxGanttComponent.prototype.ngOnInit = function () {
2923
+ var _this = this;
2924
+ _super.prototype.onInit.call(this);
2925
+ this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
2926
+ _this.dragContainer.linkDragStarted.pipe(operators.takeUntil(_this.ngUnsubscribe$)).subscribe(function (event) {
2927
+ _this.linkDragStarted.emit(event);
2928
+ });
2929
+ _this.dragContainer.linkDragEnded.pipe(operators.takeUntil(_this.ngUnsubscribe$)).subscribe(function (event) {
2930
+ _this.linkDragEnded.emit(event);
2931
+ });
2932
+ });
2834
2933
  };
2835
- return IsGanttBarItemPipe;
2836
- }());
2837
- IsGanttBarItemPipe.decorators = [
2838
- { type: core.Pipe, args: [{
2839
- name: 'isGanttBarItem'
2840
- },] }
2841
- ];
2842
- var IsGanttCustomItemPipe = /** @class */ (function () {
2843
- function IsGanttCustomItemPipe() {
2844
- }
2845
- IsGanttCustomItemPipe.prototype.transform = function (value) {
2846
- return value === exports.GanttItemType.custom;
2934
+ NgxGanttComponent.prototype.ngAfterViewInit = function () {
2935
+ var _this = this;
2936
+ this.columns.changes.pipe(operators.startWith(true), operators.takeUntil(this.ngUnsubscribe$)).subscribe(function () {
2937
+ _this.columns.forEach(function (column) {
2938
+ if (!column.columnWidth) {
2939
+ column.columnWidth = coercion.coerceCssPixelValue(defaultColumnWidth);
2940
+ }
2941
+ });
2942
+ _this.cdr.detectChanges();
2943
+ });
2847
2944
  };
2848
- return IsGanttCustomItemPipe;
2849
- }());
2850
- IsGanttCustomItemPipe.decorators = [
2851
- { type: core.Pipe, args: [{
2852
- name: 'isGanttCustomItem'
2853
- },] }
2854
- ];
2945
+ NgxGanttComponent.prototype.ngOnChanges = function (changes) {
2946
+ _super.prototype.onChanges.call(this, changes);
2947
+ };
2948
+ NgxGanttComponent.prototype.expandChildren = function (item) {
2949
+ var _this = this;
2950
+ if (!item.expanded) {
2951
+ item.setExpand(true);
2952
+ if (this.async && this.childrenResolve && item.children.length === 0) {
2953
+ item.loading = true;
2954
+ this.childrenResolve(item.origin)
2955
+ .pipe(operators.take(1), operators.finalize(function () {
2956
+ item.loading = false;
2957
+ _this.expandChange.emit();
2958
+ _this.cdr.detectChanges();
2959
+ }))
2960
+ .subscribe(function (items) {
2961
+ item.addChildren(items);
2962
+ _this.computeItemsRefs.apply(_this, __spreadArray([], __read(item.children)));
2963
+ });
2964
+ }
2965
+ else {
2966
+ this.computeItemsRefs.apply(this, __spreadArray([], __read(item.children)));
2967
+ this.expandChange.emit();
2968
+ }
2969
+ }
2970
+ else {
2971
+ item.setExpand(false);
2972
+ this.expandChange.emit();
2973
+ }
2974
+ };
2975
+ NgxGanttComponent.prototype.ngOnDestroy = function () {
2976
+ _super.prototype.onDestroy.call(this);
2977
+ };
2978
+ return NgxGanttComponent;
2979
+ }(GanttUpper));
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 });
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: [
2982
+ {
2983
+ provide: GANTT_UPPER_TOKEN,
2984
+ useExisting: NgxGanttComponent
2985
+ },
2986
+ {
2987
+ provide: GANTT_ABSTRACT_TOKEN,
2988
+ useExisting: i0.forwardRef(function () { return NgxGanttComponent; })
2989
+ }
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 });
2991
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttComponent, decorators: [{
2992
+ type: i0.Component,
2993
+ args: [{
2994
+ selector: 'ngx-gantt',
2995
+ templateUrl: './gantt.component.html',
2996
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
2997
+ providers: [
2998
+ {
2999
+ provide: GANTT_UPPER_TOKEN,
3000
+ useExisting: NgxGanttComponent
3001
+ },
3002
+ {
3003
+ provide: GANTT_ABSTRACT_TOKEN,
3004
+ useExisting: i0.forwardRef(function () { return NgxGanttComponent; })
3005
+ }
3006
+ ]
3007
+ }]
3008
+ }], ctorParameters: function () {
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]
3012
+ }] }];
3013
+ }, propDecorators: { maxLevel: [{
3014
+ type: i0.Input
3015
+ }], async: [{
3016
+ type: i0.Input
3017
+ }], childrenResolve: [{
3018
+ type: i0.Input
3019
+ }], linkable: [{
3020
+ type: i0.Input
3021
+ }], linkDragStarted: [{
3022
+ type: i0.Output
3023
+ }], linkDragEnded: [{
3024
+ type: i0.Output
3025
+ }], lineClick: [{
3026
+ type: i0.Output
3027
+ }], table: [{
3028
+ type: i0.ContentChild,
3029
+ args: [NgxGanttTableComponent]
3030
+ }], columns: [{
3031
+ type: i0.ContentChildren,
3032
+ args: [NgxGanttTableColumnComponent, { descendants: true }]
3033
+ }], tableEmptyTemplate: [{
3034
+ type: i0.ContentChild,
3035
+ args: ['tableEmpty', { static: true }]
3036
+ }] } });
2855
3037
 
2856
3038
  var NgxGanttModule = /** @class */ (function () {
2857
3039
  function NgxGanttModule() {
2858
3040
  }
2859
3041
  return NgxGanttModule;
2860
3042
  }());
2861
- NgxGanttModule.decorators = [
2862
- { type: core.NgModule, args: [{
2863
- imports: [common.CommonModule, dragDrop.DragDropModule],
2864
- exports: [NgxGanttComponent, NgxGanttTableComponent, NgxGanttTableColumnComponent, NgxGanttRootComponent, NgxGanttBarComponent],
2865
- declarations: [
2866
- NgxGanttComponent,
2867
- NgxGanttTableComponent,
2868
- NgxGanttTableColumnComponent,
2869
- GanttTableComponent,
2870
- GanttMainComponent,
2871
- GanttCalendarComponent,
2872
- GanttLinksComponent,
2873
- NgxGanttBarComponent,
2874
- GanttIconComponent,
2875
- GanttDragBackdropComponent,
2876
- NgxGanttRangeComponent,
2877
- NgxGanttRootComponent,
2878
- IsGanttRangeItemPipe,
2879
- IsGanttBarItemPipe,
2880
- IsGanttCustomItemPipe
2881
- ],
2882
- providers: []
2883
- },] }
2884
- ];
3043
+ NgxGanttModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
3044
+ NgxGanttModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, declarations: [NgxGanttComponent,
3045
+ NgxGanttTableComponent,
3046
+ NgxGanttTableColumnComponent,
3047
+ GanttTableComponent,
3048
+ GanttMainComponent,
3049
+ GanttCalendarComponent,
3050
+ GanttLinksComponent,
3051
+ NgxGanttBarComponent,
3052
+ GanttIconComponent,
3053
+ GanttDragBackdropComponent,
3054
+ NgxGanttRangeComponent,
3055
+ NgxGanttRootComponent,
3056
+ IsGanttRangeItemPipe,
3057
+ IsGanttBarItemPipe,
3058
+ IsGanttCustomItemPipe], imports: [i2.CommonModule, i1.DragDropModule], exports: [NgxGanttComponent,
3059
+ NgxGanttTableComponent,
3060
+ NgxGanttTableColumnComponent,
3061
+ NgxGanttRootComponent,
3062
+ NgxGanttBarComponent,
3063
+ NgxGanttRangeComponent] });
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]] });
3070
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, decorators: [{
3071
+ type: i0.NgModule,
3072
+ args: [{
3073
+ imports: [i2.CommonModule, i1.DragDropModule],
3074
+ exports: [
3075
+ NgxGanttComponent,
3076
+ NgxGanttTableComponent,
3077
+ NgxGanttTableColumnComponent,
3078
+ NgxGanttRootComponent,
3079
+ NgxGanttBarComponent,
3080
+ NgxGanttRangeComponent
3081
+ ],
3082
+ declarations: [
3083
+ NgxGanttComponent,
3084
+ NgxGanttTableComponent,
3085
+ NgxGanttTableColumnComponent,
3086
+ GanttTableComponent,
3087
+ GanttMainComponent,
3088
+ GanttCalendarComponent,
3089
+ GanttLinksComponent,
3090
+ NgxGanttBarComponent,
3091
+ GanttIconComponent,
3092
+ GanttDragBackdropComponent,
3093
+ NgxGanttRangeComponent,
3094
+ NgxGanttRootComponent,
3095
+ IsGanttRangeItemPipe,
3096
+ IsGanttBarItemPipe,
3097
+ IsGanttCustomItemPipe
3098
+ ],
3099
+ providers: [
3100
+ {
3101
+ provide: GANTT_GLOBAL_CONFIG,
3102
+ useValue: defaultConfig
3103
+ }
3104
+ ]
3105
+ }]
3106
+ }] });
2885
3107
 
2886
3108
  /*
2887
3109
  * Public API Surface of gantt
@@ -3083,6 +3305,7 @@
3083
3305
  return dateFns.startOfYear;
3084
3306
  }
3085
3307
  });
3308
+ exports.GANTT_GLOBAL_CONFIG = GANTT_GLOBAL_CONFIG;
3086
3309
  exports.GANTT_UPPER_TOKEN = GANTT_UPPER_TOKEN;
3087
3310
  exports.GanttBarClickEvent = GanttBarClickEvent;
3088
3311
  exports.GanttDate = GanttDate;
@@ -3101,26 +3324,16 @@
3101
3324
  exports.IsGanttBarItemPipe = IsGanttBarItemPipe;
3102
3325
  exports.IsGanttCustomItemPipe = IsGanttCustomItemPipe;
3103
3326
  exports.IsGanttRangeItemPipe = IsGanttRangeItemPipe;
3327
+ exports.NgxGanttBarComponent = NgxGanttBarComponent;
3104
3328
  exports.NgxGanttComponent = NgxGanttComponent;
3105
3329
  exports.NgxGanttModule = NgxGanttModule;
3330
+ exports.NgxGanttRangeComponent = NgxGanttRangeComponent;
3106
3331
  exports.NgxGanttRootComponent = NgxGanttRootComponent;
3107
3332
  exports.NgxGanttTableColumnComponent = NgxGanttTableColumnComponent;
3108
3333
  exports.NgxGanttTableComponent = NgxGanttTableComponent;
3109
- exports.defaultColumnWidth = defaultColumnWidth;
3110
- exports.minColumnWidth = minColumnWidth;
3334
+ exports.defaultConfig = defaultConfig;
3111
3335
  exports.primaryDatePointTop = primaryDatePointTop;
3112
3336
  exports.secondaryDatePointTop = secondaryDatePointTop;
3113
- exports.ɵa = GanttDomService;
3114
- exports.ɵb = GanttDragContainer;
3115
- exports.ɵc = NgxGanttBarComponent;
3116
- exports.ɵd = GanttBarDrag;
3117
- exports.ɵe = GanttTableComponent;
3118
- exports.ɵf = GanttMainComponent;
3119
- exports.ɵg = GanttCalendarComponent;
3120
- exports.ɵh = GanttLinksComponent;
3121
- exports.ɵi = GanttIconComponent;
3122
- exports.ɵj = GanttDragBackdropComponent;
3123
- exports.ɵk = NgxGanttRangeComponent;
3124
3337
 
3125
3338
  Object.defineProperty(exports, '__esModule', { value: true });
3126
3339