@worktile/gantt 12.0.2 → 12.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -659,11 +659,24 @@
659
659
  return GanttGroupInternal;
660
660
  }());
661
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
+
662
674
  var primaryDatePointTop = 18;
663
675
  var secondaryDatePointTop = 36;
664
676
  var viewOptions$5 = {
665
677
  min: new GanttDate().addYears(-1).startOfYear(),
666
- max: new GanttDate().addYears(1).endOfYear()
678
+ max: new GanttDate().addYears(1).endOfYear(),
679
+ dateFormat: defaultConfig.dateFormat
667
680
  };
668
681
  var GanttView = /** @class */ (function () {
669
682
  function GanttView(start, end, options) {
@@ -816,7 +829,7 @@
816
829
  var points = [];
817
830
  for (var i = 0; i < quarters; i++) {
818
831
  var start = this.start.addQuarters(i);
819
- var point = new GanttDatePoint(start, start.format('yyyy年QQQ'), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
832
+ var point = new GanttDatePoint(start, start.format(this.options.dateFormat.yearQuarter), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
820
833
  points.push(point);
821
834
  }
822
835
  return points;
@@ -826,7 +839,7 @@
826
839
  var points = [];
827
840
  for (var i = 0; i < months.length; i++) {
828
841
  var start = new GanttDate(months[i]);
829
- 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);
830
843
  points.push(point);
831
844
  }
832
845
  return points;
@@ -865,7 +878,7 @@
865
878
  var points = [];
866
879
  for (var i = 0; i < years.length; i++) {
867
880
  var start = new GanttDate(years[i]);
868
- var point = new GanttDatePoint(start, start.format('yyyy') + "\u5E74", (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
881
+ var point = new GanttDatePoint(start, "" + start.format(this.options.dateFormat.year), (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
869
882
  points.push(point);
870
883
  }
871
884
  return points;
@@ -875,7 +888,7 @@
875
888
  var points = [];
876
889
  for (var i = 0; i <= quarters; i++) {
877
890
  var start = this.start.addQuarters(i);
878
- 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);
879
892
  points.push(point);
880
893
  }
881
894
  return points;
@@ -916,7 +929,7 @@
916
929
  for (var i = 0; i < weeks.length; i++) {
917
930
  var weekStart = new GanttDate(weeks[i]);
918
931
  var increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
919
- var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format('yyyy年MM月'), (this.getCellWidth() * 7) / 2 + i * (this.getCellWidth() * 7), primaryDatePointTop);
932
+ var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.yearMonth), (this.getCellWidth() * 7) / 2 + i * (this.getCellWidth() * 7), primaryDatePointTop);
920
933
  points.push(point);
921
934
  }
922
935
  return points;
@@ -967,7 +980,7 @@
967
980
  for (var i = 0; i < weeks.length; i++) {
968
981
  var weekStart = new GanttDate(weeks[i]);
969
982
  var increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
970
- var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format('yyyy年'), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
983
+ var point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.year), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
971
984
  points.push(point);
972
985
  }
973
986
  return points;
@@ -977,7 +990,7 @@
977
990
  var points = [];
978
991
  for (var i = 0; i < weeks.length; i++) {
979
992
  var start = new GanttDate(weeks[i]);
980
- 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);
981
994
  points.push(point);
982
995
  }
983
996
  return points;
@@ -1025,7 +1038,7 @@
1025
1038
  var pointTop = 27;
1026
1039
  for (var i = 0; i <= years; i++) {
1027
1040
  var start = this.start.addYears(i);
1028
- 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);
1029
1042
  points.push(point);
1030
1043
  }
1031
1044
  return points;
@@ -1122,16 +1135,19 @@
1122
1135
  }
1123
1136
 
1124
1137
  var GanttUpper = /** @class */ (function () {
1125
- function GanttUpper(elementRef, cdr, ngZone) {
1138
+ function GanttUpper(elementRef, cdr, ngZone, config) {
1126
1139
  this.elementRef = elementRef;
1127
1140
  this.cdr = cdr;
1128
1141
  this.ngZone = ngZone;
1142
+ this.config = config;
1129
1143
  this.originItems = [];
1130
1144
  this.originGroups = [];
1131
1145
  this.viewType = exports.GanttViewType.month;
1132
1146
  this.showTodayLine = true;
1147
+ this.viewOptions = {};
1133
1148
  this.loadOnScroll = new i0.EventEmitter();
1134
1149
  this.dragStarted = new i0.EventEmitter();
1150
+ this.dragMoved = new i0.EventEmitter();
1135
1151
  this.dragEnded = new i0.EventEmitter();
1136
1152
  this.barClick = new i0.EventEmitter();
1137
1153
  this.linkDragEnded = new i0.EventEmitter();
@@ -1251,6 +1267,7 @@
1251
1267
  GanttUpper.prototype.onInit = function () {
1252
1268
  var _this = this;
1253
1269
  this.styles = Object.assign({}, defaultStyles, this.styles);
1270
+ this.viewOptions.dateFormat = Object.assign({}, defaultConfig.dateFormat, this.config.dateFormat, this.viewOptions.dateFormat);
1254
1271
  this.createView();
1255
1272
  this.setupGroups();
1256
1273
  this.setupItems();
@@ -1261,6 +1278,9 @@
1261
1278
  _this.dragContainer.dragStarted.subscribe(function (event) {
1262
1279
  _this.dragStarted.emit(event);
1263
1280
  });
1281
+ _this.dragContainer.dragMoved.subscribe(function (event) {
1282
+ _this.dragMoved.emit(event);
1283
+ });
1264
1284
  _this.dragContainer.dragEnded.subscribe(function (event) {
1265
1285
  _this.dragEnded.emit(event);
1266
1286
  _this.computeRefs();
@@ -1306,7 +1326,7 @@
1306
1326
  });
1307
1327
  });
1308
1328
  };
1309
- GanttUpper.prototype.trackBy = function (item, index) {
1329
+ GanttUpper.prototype.trackBy = function (index, item) {
1310
1330
  return item.id || index;
1311
1331
  };
1312
1332
  GanttUpper.prototype.detectChanges = function () {
@@ -1324,13 +1344,31 @@
1324
1344
  GanttUpper.prototype.collapseAll = function () {
1325
1345
  this.expandGroups(false);
1326
1346
  };
1347
+ GanttUpper.prototype.getGanttItem = function (id) {
1348
+ return this.getGanttItems([id])[0] || null;
1349
+ };
1350
+ GanttUpper.prototype.getGanttItems = function (ids) {
1351
+ var items = [];
1352
+ if (this.items.length > 0) {
1353
+ items = recursiveItems(this.items);
1354
+ }
1355
+ else {
1356
+ items = flatten(this.groups.map(function (group) { return recursiveItems(group.items); }));
1357
+ }
1358
+ return items.filter(function (item) { return ids.includes(item.id); });
1359
+ };
1327
1360
  return GanttUpper;
1328
1361
  }());
1329
- GanttUpper.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttUpper, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1330
- GanttUpper.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.2", type: GanttUpper, inputs: { originItems: ["items", "originItems"], originGroups: ["groups", "originGroups"], viewType: "viewType", start: "start", end: "end", showTodayLine: "showTodayLine", draggable: "draggable", styles: "styles", viewOptions: "viewOptions", disabledLoadOnScroll: "disabledLoadOnScroll" }, outputs: { loadOnScroll: "loadOnScroll", dragStarted: "dragStarted", dragEnded: "dragEnded", barClick: "barClick" }, host: { properties: { "class.gantt": "this.ganttClass" } }, queries: [{ propertyName: "barTemplate", first: true, predicate: ["bar"], descendants: true, static: true }, { propertyName: "rangeTemplate", first: true, predicate: ["range"], descendants: true, static: true }, { propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, static: true }, { propertyName: "groupTemplate", first: true, predicate: ["group"], descendants: true, static: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ["groupHeader"], descendants: true, static: true }], ngImport: i0__namespace });
1362
+ 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 });
1363
+ GanttUpper.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.2", type: GanttUpper, inputs: { originItems: ["items", "originItems"], originGroups: ["groups", "originGroups"], viewType: "viewType", start: "start", end: "end", showTodayLine: "showTodayLine", draggable: "draggable", styles: "styles", viewOptions: "viewOptions", disabledLoadOnScroll: "disabledLoadOnScroll" }, outputs: { loadOnScroll: "loadOnScroll", dragStarted: "dragStarted", dragMoved: "dragMoved", dragEnded: "dragEnded", barClick: "barClick" }, host: { properties: { "class.gantt": "this.ganttClass" } }, queries: [{ propertyName: "barTemplate", first: true, predicate: ["bar"], descendants: true, static: true }, { propertyName: "rangeTemplate", first: true, predicate: ["range"], descendants: true, static: true }, { propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, static: true }, { propertyName: "groupTemplate", first: true, predicate: ["group"], descendants: true, static: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ["groupHeader"], descendants: true, static: true }], ngImport: i0__namespace });
1331
1364
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttUpper, decorators: [{
1332
1365
  type: i0.Directive
1333
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }]; }, propDecorators: { originItems: [{
1366
+ }], ctorParameters: function () {
1367
+ return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }, { type: undefined, decorators: [{
1368
+ type: i0.Inject,
1369
+ args: [GANTT_GLOBAL_CONFIG]
1370
+ }] }];
1371
+ }, propDecorators: { originItems: [{
1334
1372
  type: i0.Input,
1335
1373
  args: ['items']
1336
1374
  }], originGroups: [{
@@ -1356,6 +1394,8 @@
1356
1394
  type: i0.Output
1357
1395
  }], dragStarted: [{
1358
1396
  type: i0.Output
1397
+ }], dragMoved: [{
1398
+ type: i0.Output
1359
1399
  }], dragEnded: [{
1360
1400
  type: i0.Output
1361
1401
  }], barClick: [{
@@ -1428,7 +1468,7 @@
1428
1468
  return NgxGanttTableComponent;
1429
1469
  }());
1430
1470
  NgxGanttTableComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttTableComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1431
- NgxGanttTableComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: NgxGanttTableComponent, selector: "ngx-gantt-table", outputs: { columnChanges: "columnChanges" }, ngImport: i0__namespace, template: '', isInline: true });
1471
+ NgxGanttTableComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: NgxGanttTableComponent, selector: "ngx-gantt-table", outputs: { columnChanges: "columnChanges" }, queries: [{ propertyName: "rowBeforeTemplate", first: true, predicate: ["rowBeforeSlot"], descendants: true, static: true }, { propertyName: "rowAfterTemplate", first: true, predicate: ["rowAfterSlot"], descendants: true, static: true }], ngImport: i0__namespace, template: '', isInline: true });
1432
1472
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttTableComponent, decorators: [{
1433
1473
  type: i0.Component,
1434
1474
  args: [{
@@ -1437,6 +1477,12 @@
1437
1477
  }]
1438
1478
  }], ctorParameters: function () { return []; }, propDecorators: { columnChanges: [{
1439
1479
  type: i0.Output
1480
+ }], rowBeforeTemplate: [{
1481
+ type: i0.ContentChild,
1482
+ args: ['rowBeforeSlot', { static: true }]
1483
+ }], rowAfterTemplate: [{
1484
+ type: i0.ContentChild,
1485
+ args: ['rowAfterSlot', { static: true }]
1440
1486
  }] } });
1441
1487
 
1442
1488
  var GANTT_ABSTRACT_TOKEN = new i0.InjectionToken('gantt-abstract-token');
@@ -1654,10 +1700,13 @@
1654
1700
  GanttTableComponent.prototype.hideAuxiliaryLine = function () {
1655
1701
  this.draglineElementRef.nativeElement.style.display = 'none';
1656
1702
  };
1703
+ GanttTableComponent.prototype.trackBy = function (index, item) {
1704
+ return item.id || index;
1705
+ };
1657
1706
  return GanttTableComponent;
1658
1707
  }());
1659
1708
  GanttTableComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttTableComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1660
- GanttTableComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttTableComponent, selector: "gantt-table", inputs: { groups: "groups", items: "items", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate" }, host: { properties: { "class.gantt-table": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass" } }, viewQueries: [{ propertyName: "draglineElementRef", first: true, predicate: ["dragLine"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"gantt-table-header gantt-table-row\">\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let i = index\" [style.width]=\"column.columnWidth\">\n <ng-container *ngIf=\"column.headerTemplateRef; else default\" [ngTemplateOutlet]=\"column.headerTemplateRef\"></ng-container>\n <ng-template #default>\n {{ column.name }}\n </ng-template>\n <div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event, column)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"columnDragEnded($event, column)\"\n ></div>\n </div>\n</div>\n<div class=\"gantt-table-body\">\n <ng-container *ngIf=\"!groups.length && !items.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"groups && groups.length > 0; else itemsTemplate\">\n <ng-container *ngFor=\"let group of groups\">\n <div class=\"gantt-table-group\" [ngClass]=\"group.class\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"group.expanded\" (click)=\"expandGroup(group)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"group.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.origin, group: group.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ group.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <ng-container *ngIf=\"group.expanded\">\n <ng-template\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ group: group, items: group.items, level: 0 }\"\n ></ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"tableDragEnded($event)\"\n></div>\n\n<div #dragLine class=\"gantt-table-drag-auxiliary-line\"></div>\n\n<ng-template #itemsTemplate>\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items, level: 0 }\"></ng-template>\n</ng-template>\n\n<ng-template #ganttItems let-group=\"group\" let-items=\"items\" let-level=\"level\">\n <ng-container *ngFor=\"let item of items\">\n <div\n class=\"gantt-table-item gantt-table-row\"\n [class.gantt-table-item-first-level-group]=\"level === 0 && (item.type | isGanttRangeItem)\"\n [class.gantt-table-item-with-group]=\"group\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n >\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let first = first\" [style.width]=\"column.columnWidth\">\n <div *ngIf=\"first\" class=\"gantt-expand-icon\" [style.marginLeft.px]=\"level * 20\">\n <ng-container *ngIf=\"level < gantt.maxLevel - 1 && item.expandable\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren(item)\"\n ></gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children, level: level + 1, group: group }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n", components: [{ type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }], directives: [{ type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1__namespace.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragDisabled", "cdkDragStartDelay", "cdkDragLockAxis", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragBoundary", "cdkDragRootElement", "cdkDragData", "cdkDragFreeDragPosition"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i2__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "isGanttRangeItem": IsGanttRangeItemPipe } });
1709
+ GanttTableComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttTableComponent, selector: "gantt-table", inputs: { groups: "groups", items: "items", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate", rowBeforeTemplate: "rowBeforeTemplate", rowAfterTemplate: "rowAfterTemplate" }, host: { properties: { "class.gantt-table": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass" } }, viewQueries: [{ propertyName: "draglineElementRef", first: true, predicate: ["dragLine"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"gantt-table-header gantt-table-row\">\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let i = index\" [style.width]=\"column.columnWidth\">\n <ng-container *ngIf=\"column.headerTemplateRef; else default\" [ngTemplateOutlet]=\"column.headerTemplateRef\"></ng-container>\n <ng-template #default>\n {{ column.name }}\n </ng-template>\n <div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event, column)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"columnDragEnded($event, column)\"\n ></div>\n </div>\n</div>\n<div class=\"gantt-table-body\">\n <ng-container *ngIf=\"!groups.length && !items.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"groups && groups.length > 0; else itemsTemplate\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"group.class\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"group.expanded\" (click)=\"expandGroup(group)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"group.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.origin, group: group.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ group.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <ng-container *ngIf=\"group.expanded\">\n <ng-template\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ group: group, items: group.items, level: 0 }\"\n ></ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"tableDragEnded($event)\"\n></div>\n\n<div #dragLine class=\"gantt-table-drag-auxiliary-line\"></div>\n\n<ng-template #itemsTemplate>\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items, level: 0 }\"></ng-template>\n</ng-template>\n\n<ng-template #ganttItems let-group=\"group\" let-items=\"items\" let-level=\"level\">\n <ng-container *ngFor=\"let item of items; trackBy: trackBy\">\n <div\n class=\"gantt-table-item gantt-table-row\"\n [class.gantt-table-item-first-level-group]=\"level === 0 && (item.type | isGanttRangeItem)\"\n [class.gantt-table-item-with-group]=\"group\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let first = first\" [style.width]=\"column.columnWidth\">\n <div *ngIf=\"first\" class=\"gantt-expand-icon\" [style.marginLeft.px]=\"level * 20\">\n <ng-container *ngIf=\"level < gantt.maxLevel - 1 && item.expandable\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren(item)\"\n ></gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n <ng-template\n [ngTemplateOutlet]=\"rowAfterTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children, level: level + 1, group: group }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n", components: [{ type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }], directives: [{ type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1__namespace.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragDisabled", "cdkDragStartDelay", "cdkDragLockAxis", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragBoundary", "cdkDragRootElement", "cdkDragData", "cdkDragFreeDragPosition"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i2__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "isGanttRangeItem": IsGanttRangeItemPipe } });
1661
1710
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: GanttTableComponent, decorators: [{
1662
1711
  type: i0.Component,
1663
1712
  args: [{
@@ -1679,6 +1728,10 @@
1679
1728
  type: i0.Input
1680
1729
  }], emptyTemplate: [{
1681
1730
  type: i0.Input
1731
+ }], rowBeforeTemplate: [{
1732
+ type: i0.Input
1733
+ }], rowAfterTemplate: [{
1734
+ type: i0.Input
1682
1735
  }], draglineElementRef: [{
1683
1736
  type: i0.ViewChild,
1684
1737
  args: ['dragLine', { static: true }]
@@ -1795,6 +1848,7 @@
1795
1848
  var GanttDragContainer = /** @class */ (function () {
1796
1849
  function GanttDragContainer() {
1797
1850
  this.dragStarted = new i0.EventEmitter();
1851
+ this.dragMoved = new i0.EventEmitter();
1798
1852
  this.dragEnded = new i0.EventEmitter();
1799
1853
  this.linkDragStarted = new i0.EventEmitter();
1800
1854
  this.linkDragEntered = new i0.EventEmitter();
@@ -2033,7 +2087,7 @@
2033
2087
  };
2034
2088
  GanttCalendarComponent.prototype.ngAfterViewInit = function () { };
2035
2089
  GanttCalendarComponent.prototype.ngOnChanges = function (changes) { };
2036
- GanttCalendarComponent.prototype.trackBy = function (point, index) {
2090
+ GanttCalendarComponent.prototype.trackBy = function (index, point) {
2037
2091
  return point.text || index;
2038
2092
  };
2039
2093
  GanttCalendarComponent.prototype.ngOnDestroy = function () {
@@ -2548,6 +2602,8 @@
2548
2602
  var start = _this.ganttUpper.view.getDateByXPoint(x);
2549
2603
  var end = start.addDays(days);
2550
2604
  _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), end);
2605
+ _this.item.updateDate(start, end);
2606
+ _this.dragContainer.dragMoved.emit({ item: _this.item.origin });
2551
2607
  });
2552
2608
  dragRef.ended.subscribe(function (event) {
2553
2609
  var days = dateFns.differenceInCalendarDays(_this.item.end.value, _this.item.start.value);
@@ -2583,6 +2639,7 @@
2583
2639
  _this.barElement.style.width = width + 'px';
2584
2640
  _this.barElement.style.left = x + 'px';
2585
2641
  _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), _this.ganttUpper.view.getDateByXPoint(x + width));
2642
+ _this.item.updateDate(_this.ganttUpper.view.getDateByXPoint(x), _this.item.end);
2586
2643
  }
2587
2644
  }
2588
2645
  else {
@@ -2591,7 +2648,9 @@
2591
2648
  _this.barElement.style.width = width + 'px';
2592
2649
  _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x), _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + width));
2593
2650
  }
2651
+ _this.item.updateDate(_this.item.start, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + width));
2594
2652
  }
2653
+ _this.dragContainer.dragMoved.emit({ item: _this.item.origin });
2595
2654
  event.source.reset();
2596
2655
  });
2597
2656
  dragRef.ended.subscribe(function (event) {
@@ -2847,7 +2906,7 @@
2847
2906
  this.ganttMainClass = true;
2848
2907
  }
2849
2908
  GanttMainComponent.prototype.ngOnInit = function () { };
2850
- GanttMainComponent.prototype.trackBy = function (item, index) {
2909
+ GanttMainComponent.prototype.trackBy = function (index, item) {
2851
2910
  return item.id || index;
2852
2911
  };
2853
2912
  return GanttMainComponent;
@@ -2888,8 +2947,8 @@
2888
2947
 
2889
2948
  var NgxGanttComponent = /** @class */ (function (_super) {
2890
2949
  __extends(NgxGanttComponent, _super);
2891
- function NgxGanttComponent(elementRef, cdr, ngZone) {
2892
- var _this = _super.call(this, elementRef, cdr, ngZone) || this;
2950
+ function NgxGanttComponent(elementRef, cdr, ngZone, config) {
2951
+ var _this = _super.call(this, elementRef, cdr, ngZone, config) || this;
2893
2952
  _this.maxLevel = 2;
2894
2953
  _this.linkDragStarted = new i0.EventEmitter();
2895
2954
  _this.linkDragEnded = new i0.EventEmitter();
@@ -2956,7 +3015,7 @@
2956
3015
  };
2957
3016
  return NgxGanttComponent;
2958
3017
  }(GanttUpper));
2959
- NgxGanttComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Component });
3018
+ 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 });
2960
3019
  NgxGanttComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick" }, providers: [
2961
3020
  {
2962
3021
  provide: GANTT_UPPER_TOKEN,
@@ -2966,7 +3025,7 @@
2966
3025
  provide: GANTT_ABSTRACT_TOKEN,
2967
3026
  useExisting: i0.forwardRef(function () { return NgxGanttComponent; })
2968
3027
  }
2969
- ], queries: [{ propertyName: "table", first: true, predicate: NgxGanttTableComponent, descendants: true }, { propertyName: "tableEmptyTemplate", first: true, predicate: ["tableEmpty"], descendants: true, static: true }, { propertyName: "columns", predicate: NgxGanttTableColumnComponent, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<ngx-gantt-root>\n <ng-template #sideTemplate>\n <gantt-table [groups]=\"groups\" [items]=\"items\" [columns]=\"columns\" [groupTemplate]=\"groupTemplate\" [emptyTemplate]=\"tableEmptyTemplate\"></gantt-table>\n </ng-template>\n <ng-template #mainTemplate>\n <gantt-main\n [groups]=\"groups\"\n [items]=\"items\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </ng-template>\n</ngx-gantt-root>\n", components: [{ type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }, { type: GanttTableComponent, selector: "gantt-table", inputs: ["groups", "items", "columns", "groupTemplate", "emptyTemplate"] }, { type: GanttMainComponent, selector: "gantt-main", inputs: ["groups", "items", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
3028
+ ], queries: [{ propertyName: "table", first: true, predicate: NgxGanttTableComponent, descendants: true }, { propertyName: "tableEmptyTemplate", first: true, predicate: ["tableEmpty"], descendants: true, static: true }, { propertyName: "columns", predicate: NgxGanttTableColumnComponent, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<ngx-gantt-root>\n <ng-template #sideTemplate>\n <gantt-table\n [groups]=\"groups\"\n [items]=\"items\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n ></gantt-table>\n </ng-template>\n <ng-template #mainTemplate>\n <gantt-main\n [groups]=\"groups\"\n [items]=\"items\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </ng-template>\n</ngx-gantt-root>\n", components: [{ type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }, { type: GanttTableComponent, selector: "gantt-table", inputs: ["groups", "items", "columns", "groupTemplate", "emptyTemplate", "rowBeforeTemplate", "rowAfterTemplate"] }, { type: GanttMainComponent, selector: "gantt-main", inputs: ["groups", "items", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
2970
3029
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttComponent, decorators: [{
2971
3030
  type: i0.Component,
2972
3031
  args: [{
@@ -2984,7 +3043,12 @@
2984
3043
  }
2985
3044
  ]
2986
3045
  }]
2987
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }]; }, propDecorators: { maxLevel: [{
3046
+ }], ctorParameters: function () {
3047
+ return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }, { type: i0__namespace.NgZone }, { type: undefined, decorators: [{
3048
+ type: i0.Inject,
3049
+ args: [GANTT_GLOBAL_CONFIG]
3050
+ }] }];
3051
+ }, propDecorators: { maxLevel: [{
2988
3052
  type: i0.Input
2989
3053
  }], async: [{
2990
3054
  type: i0.Input
@@ -3035,7 +3099,12 @@
3035
3099
  NgxGanttRootComponent,
3036
3100
  NgxGanttBarComponent,
3037
3101
  NgxGanttRangeComponent] });
3038
- NgxGanttModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, providers: [], imports: [[i2.CommonModule, i1.DragDropModule]] });
3102
+ NgxGanttModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, providers: [
3103
+ {
3104
+ provide: GANTT_GLOBAL_CONFIG,
3105
+ useValue: defaultConfig
3106
+ }
3107
+ ], imports: [[i2.CommonModule, i1.DragDropModule]] });
3039
3108
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0__namespace, type: NgxGanttModule, decorators: [{
3040
3109
  type: i0.NgModule,
3041
3110
  args: [{
@@ -3065,7 +3134,12 @@
3065
3134
  IsGanttBarItemPipe,
3066
3135
  IsGanttCustomItemPipe
3067
3136
  ],
3068
- providers: []
3137
+ providers: [
3138
+ {
3139
+ provide: GANTT_GLOBAL_CONFIG,
3140
+ useValue: defaultConfig
3141
+ }
3142
+ ]
3069
3143
  }]
3070
3144
  }] });
3071
3145
 
@@ -3269,6 +3343,7 @@
3269
3343
  return dateFns.startOfYear;
3270
3344
  }
3271
3345
  });
3346
+ exports.GANTT_GLOBAL_CONFIG = GANTT_GLOBAL_CONFIG;
3272
3347
  exports.GANTT_UPPER_TOKEN = GANTT_UPPER_TOKEN;
3273
3348
  exports.GanttBarClickEvent = GanttBarClickEvent;
3274
3349
  exports.GanttDate = GanttDate;
@@ -3294,6 +3369,7 @@
3294
3369
  exports.NgxGanttRootComponent = NgxGanttRootComponent;
3295
3370
  exports.NgxGanttTableColumnComponent = NgxGanttTableColumnComponent;
3296
3371
  exports.NgxGanttTableComponent = NgxGanttTableComponent;
3372
+ exports.defaultConfig = defaultConfig;
3297
3373
  exports.primaryDatePointTop = primaryDatePointTop;
3298
3374
  exports.secondaryDatePointTop = secondaryDatePointTop;
3299
3375