@worktile/gantt 12.2.0-next.0 → 12.2.1

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 (49) hide show
  1. package/bundles/worktile-gantt.umd.js +516 -325
  2. package/bundles/worktile-gantt.umd.js.map +1 -1
  3. package/class/event.d.ts +6 -0
  4. package/class/index.d.ts +1 -0
  5. package/class/item.d.ts +1 -1
  6. package/class/link.d.ts +19 -4
  7. package/components/links/lines/curve.d.ts +10 -0
  8. package/components/links/lines/factory.d.ts +5 -0
  9. package/components/links/lines/line.d.ts +8 -0
  10. package/components/links/lines/straight.d.ts +9 -0
  11. package/components/links/links.component.d.ts +5 -4
  12. package/components/table/gantt-table.component.d.ts +8 -5
  13. package/esm2015/class/event.js +3 -1
  14. package/esm2015/class/index.js +2 -1
  15. package/esm2015/class/item.js +4 -3
  16. package/esm2015/class/link.js +9 -4
  17. package/esm2015/components/bar/bar-drag.js +50 -24
  18. package/esm2015/components/bar/bar.component.js +4 -4
  19. package/esm2015/components/calendar/calendar.component.js +3 -3
  20. package/esm2015/components/drag-backdrop/drag-backdrop.component.js +3 -3
  21. package/esm2015/components/icon/icon.component.js +3 -3
  22. package/esm2015/components/links/lines/curve.js +96 -0
  23. package/esm2015/components/links/lines/factory.js +14 -0
  24. package/esm2015/components/links/lines/line.js +24 -0
  25. package/esm2015/components/links/lines/straight.js +58 -0
  26. package/esm2015/components/links/links.component.js +37 -114
  27. package/esm2015/components/main/gantt-main.component.js +4 -4
  28. package/esm2015/components/range/range.component.js +3 -3
  29. package/esm2015/components/table/gantt-table.component.js +17 -7
  30. package/esm2015/gantt-dom.service.js +3 -3
  31. package/esm2015/gantt-drag-container.js +57 -40
  32. package/esm2015/gantt-item-upper.js +3 -3
  33. package/esm2015/gantt-print.service.js +3 -3
  34. package/esm2015/gantt-upper.js +55 -4
  35. package/esm2015/gantt.component.js +25 -5
  36. package/esm2015/gantt.config.js +8 -2
  37. package/esm2015/gantt.module.js +4 -4
  38. package/esm2015/gantt.pipe.js +9 -9
  39. package/esm2015/root.component.js +3 -3
  40. package/esm2015/table/gantt-column.component.js +3 -3
  41. package/esm2015/table/gantt-table.component.js +3 -3
  42. package/fesm2015/worktile-gantt.js +475 -243
  43. package/fesm2015/worktile-gantt.js.map +1 -1
  44. package/gantt-drag-container.d.ts +20 -8
  45. package/gantt-upper.d.ts +17 -2
  46. package/gantt.component.d.ts +4 -2
  47. package/gantt.config.d.ts +7 -0
  48. package/main.bundle.scss +43 -1
  49. package/package.json +1 -1
@@ -2,14 +2,16 @@ import * as i0 from '@angular/core';
2
2
  import { InjectionToken, EventEmitter, Directive, Inject, Input, Output, ContentChild, HostBinding, Component, Pipe, ViewChild, Injectable, Optional, forwardRef, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
3
3
  import * as i2 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
- import { take, skip, takeUntil, startWith, map, pairwise, auditTime, finalize } from 'rxjs/operators';
5
+ import { take, skip, takeUntil, startWith, map, pairwise, auditTime, debounceTime, finalize } from 'rxjs/operators';
6
6
  import { BehaviorSubject, Subject, merge, fromEvent } from 'rxjs';
7
7
  import { fromUnixTime, getWeek, getDaysInMonth, differenceInCalendarDays, setDate, addSeconds, addMinutes, addHours, addDays, addWeeks, addMonths, addQuarters, addYears, startOfDay, startOfWeek, startOfMonth, startOfQuarter, startOfYear, endOfDay, endOfWeek, endOfMonth, endOfQuarter, endOfYear, getUnixTime, format, isWeekend, isToday, differenceInDays, differenceInCalendarQuarters, eachMonthOfInterval, eachYearOfInterval, eachWeekOfInterval, eachDayOfInterval, differenceInCalendarYears } from 'date-fns';
8
8
  export { addDays, addHours, addMinutes, addMonths, addQuarters, addSeconds, addWeeks, addYears, differenceInCalendarDays, differenceInCalendarQuarters, differenceInDays, eachDayOfInterval, eachMonthOfInterval, eachWeekOfInterval, endOfDay, endOfMonth, endOfQuarter, endOfWeek, endOfYear, format, fromUnixTime, getDaysInMonth, getUnixTime, getWeek, isToday, isWeekend, setDate, startOfDay, startOfMonth, startOfQuarter, startOfWeek, startOfYear } from 'date-fns';
9
- import { coerceCssPixelValue } from '@angular/cdk/coercion';
9
+ import { SelectionModel } from '@angular/cdk/collections';
10
+ import { coerceBooleanProperty, coerceCssPixelValue } from '@angular/cdk/coercion';
10
11
  import * as i1 from '@angular/cdk/drag-drop';
11
12
  import { DragDropModule } from '@angular/cdk/drag-drop';
12
13
  import html2canvas from 'html2canvas';
14
+ import { __decorate, __param } from 'tslib';
13
15
 
14
16
  class GanttDatePoint {
15
17
  constructor(start, text, x, y, additions) {
@@ -33,6 +35,8 @@ class GanttLineClickEvent {
33
35
  }
34
36
  class GanttBarClickEvent {
35
37
  }
38
+ class GanttSelectedEvent {
39
+ }
36
40
 
37
41
  class GanttDate {
38
42
  constructor(date) {
@@ -203,11 +207,16 @@ var GanttViewType;
203
207
 
204
208
  var GanttLinkType;
205
209
  (function (GanttLinkType) {
206
- GanttLinkType[GanttLinkType["fs"] = 0] = "fs";
207
- GanttLinkType[GanttLinkType["ss"] = 1] = "ss";
210
+ GanttLinkType[GanttLinkType["fs"] = 1] = "fs";
208
211
  GanttLinkType[GanttLinkType["ff"] = 2] = "ff";
209
- GanttLinkType[GanttLinkType["sf"] = 3] = "sf";
212
+ GanttLinkType[GanttLinkType["ss"] = 3] = "ss";
213
+ GanttLinkType[GanttLinkType["sf"] = 4] = "sf";
210
214
  })(GanttLinkType || (GanttLinkType = {}));
215
+ var GanttLinkLineType;
216
+ (function (GanttLinkLineType) {
217
+ GanttLinkLineType["curve"] = "curve";
218
+ GanttLinkLineType["straight"] = "straight";
219
+ })(GanttLinkLineType || (GanttLinkLineType = {}));
211
220
  var LinkColors;
212
221
  (function (LinkColors) {
213
222
  LinkColors["default"] = "#cacaca";
@@ -294,8 +303,9 @@ class GanttItemInternal {
294
303
  this.expanded = expanded;
295
304
  this.origin.expanded = expanded;
296
305
  }
297
- addLink(linkId) {
298
- this.links = [...this.links, { type: GanttLinkType.fs, link: linkId }];
306
+ addLink(link) {
307
+ console.log(link);
308
+ this.links = [...this.links, link];
299
309
  this.origin.links = this.links;
300
310
  }
301
311
  }
@@ -324,7 +334,12 @@ const defaultConfig = {
324
334
  quarter: 'QQQ',
325
335
  year: 'yyyy年',
326
336
  yearMonth: 'yyyy年MM月',
327
- yearQuarter: 'yyyy年QQQ',
337
+ yearQuarter: 'yyyy年QQQ'
338
+ },
339
+ linkOptions: {
340
+ dependencyTypes: [GanttLinkType.fs],
341
+ showArrow: false,
342
+ lineType: GanttLinkLineType.curve
328
343
  }
329
344
  };
330
345
  const GANTT_GLOBAL_CONFIG = new InjectionToken('GANTT_GLOBAL_CONFIG');
@@ -794,8 +809,38 @@ class GanttUpper {
794
809
  this.expandChange = new EventEmitter();
795
810
  this.firstChange = true;
796
811
  this.unsubscribe$ = new Subject();
812
+ this._selectable = false;
813
+ this._multiple = false;
797
814
  this.ganttClass = true;
798
815
  }
816
+ set linkOptions(options) {
817
+ this._linkOptions = options;
818
+ }
819
+ get linkOptions() {
820
+ return Object.assign({}, defaultConfig.linkOptions, this.config.linkOptions, this._linkOptions);
821
+ }
822
+ set selectable(value) {
823
+ var _a;
824
+ this._selectable = coerceBooleanProperty(value);
825
+ if (this._selectable) {
826
+ this.selectionModel = this.initSelectionModel();
827
+ }
828
+ else {
829
+ (_a = this.selectionModel) === null || _a === void 0 ? void 0 : _a.clear();
830
+ }
831
+ }
832
+ get selectable() {
833
+ return this._selectable;
834
+ }
835
+ set multiple(value) {
836
+ this._multiple = coerceBooleanProperty(value);
837
+ if (this.selectable) {
838
+ this.selectionModel = this.initSelectionModel();
839
+ }
840
+ }
841
+ get multiple() {
842
+ return this._multiple;
843
+ }
799
844
  get element() {
800
845
  return this.elementRef.nativeElement;
801
846
  }
@@ -893,6 +938,9 @@ class GanttUpper {
893
938
  this.expandChange.next();
894
939
  this.cdr.detectChanges();
895
940
  }
941
+ initSelectionModel() {
942
+ return new SelectionModel(this.multiple, []);
943
+ }
896
944
  onInit() {
897
945
  this.styles = Object.assign({}, defaultStyles, this.styles);
898
946
  this.viewOptions.dateFormat = Object.assign({}, defaultConfig.dateFormat, this.config.dateFormat, this.viewOptions.dateFormat);
@@ -900,6 +948,7 @@ class GanttUpper {
900
948
  this.setupGroups();
901
949
  this.setupItems();
902
950
  this.computeRefs();
951
+ this.initSelectionModel();
903
952
  this.firstChange = false;
904
953
  this.ngZone.onStable.pipe(take(1)).subscribe(() => {
905
954
  this.element.style.opacity = '1';
@@ -980,10 +1029,19 @@ class GanttUpper {
980
1029
  }
981
1030
  return items.filter((item) => ids.includes(item.id));
982
1031
  }
1032
+ isSelected(id) {
1033
+ if (!this.selectable) {
1034
+ return false;
1035
+ }
1036
+ if (!this.selectionModel.hasValue()) {
1037
+ return false;
1038
+ }
1039
+ return this.selectionModel.isSelected(id);
1040
+ }
983
1041
  }
984
- GanttUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttUpper, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Directive });
985
- GanttUpper.ɵdir = i0.ɵɵ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 });
986
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttUpper, decorators: [{
1042
+ GanttUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttUpper, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Directive });
1043
+ GanttUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.5", type: GanttUpper, inputs: { originItems: ["items", "originItems"], originGroups: ["groups", "originGroups"], viewType: "viewType", start: "start", end: "end", showTodayLine: "showTodayLine", draggable: "draggable", styles: "styles", viewOptions: "viewOptions", linkOptions: "linkOptions", disabledLoadOnScroll: "disabledLoadOnScroll", selectable: "selectable", multiple: "multiple" }, outputs: { loadOnScroll: "loadOnScroll", dragStarted: "dragStarted", dragMoved: "dragMoved", dragEnded: "dragEnded", barClick: "barClick" }, host: { properties: { "class.gantt": "this.ganttClass" } }, queries: [{ propertyName: "barTemplate", first: true, predicate: ["bar"], descendants: true, static: true }, { propertyName: "rangeTemplate", first: true, predicate: ["range"], descendants: true, static: true }, { propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, static: true }, { propertyName: "groupTemplate", first: true, predicate: ["group"], descendants: true, static: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ["groupHeader"], descendants: true, static: true }], ngImport: i0 });
1044
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttUpper, decorators: [{
987
1045
  type: Directive
988
1046
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
989
1047
  type: Inject,
@@ -1008,8 +1066,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1008
1066
  type: Input
1009
1067
  }], viewOptions: [{
1010
1068
  type: Input
1069
+ }], linkOptions: [{
1070
+ type: Input
1011
1071
  }], disabledLoadOnScroll: [{
1012
1072
  type: Input
1073
+ }], selectable: [{
1074
+ type: Input
1075
+ }], multiple: [{
1076
+ type: Input
1013
1077
  }], loadOnScroll: [{
1014
1078
  type: Output
1015
1079
  }], dragStarted: [{
@@ -1050,9 +1114,9 @@ class NgxGanttTableColumnComponent {
1050
1114
  }
1051
1115
  ngOnInit() { }
1052
1116
  }
1053
- NgxGanttTableColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttTableColumnComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
1054
- NgxGanttTableColumnComponent.ɵcmp = i0.ɵɵ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, template: '', isInline: true });
1055
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
1117
+ NgxGanttTableColumnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttTableColumnComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
1118
+ NgxGanttTableColumnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", 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, template: '', isInline: true });
1119
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
1056
1120
  type: Component,
1057
1121
  args: [{
1058
1122
  selector: 'ngx-gantt-column',
@@ -1079,9 +1143,9 @@ class NgxGanttTableComponent {
1079
1143
  }
1080
1144
  ngOnInit() { }
1081
1145
  }
1082
- NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1083
- NgxGanttTableComponent.ɵcmp = i0.ɵɵ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, template: '', isInline: true });
1084
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttTableComponent, decorators: [{
1146
+ NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1147
+ NgxGanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", 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, template: '', isInline: true });
1148
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttTableComponent, decorators: [{
1085
1149
  type: Component,
1086
1150
  args: [{
1087
1151
  selector: 'ngx-gantt-table',
@@ -1206,9 +1270,9 @@ class GanttIconComponent {
1206
1270
  }
1207
1271
  }
1208
1272
  }
1209
- GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1210
- GanttIconComponent.ɵcmp = i0.ɵɵ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, template: '', isInline: true });
1211
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttIconComponent, decorators: [{
1273
+ GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1274
+ GanttIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: GanttIconComponent, selector: "gantt-icon", inputs: { iconName: "iconName" }, host: { properties: { "class.gantt-icon": "this.isIcon" } }, ngImport: i0, template: '', isInline: true });
1275
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttIconComponent, decorators: [{
1212
1276
  type: Component,
1213
1277
  args: [{
1214
1278
  selector: 'gantt-icon',
@@ -1226,9 +1290,9 @@ class IsGanttRangeItemPipe {
1226
1290
  return value === GanttItemType.range;
1227
1291
  }
1228
1292
  }
1229
- IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1230
- IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1231
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
1293
+ IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1294
+ IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1295
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
1232
1296
  type: Pipe,
1233
1297
  args: [{
1234
1298
  name: 'isGanttRangeItem'
@@ -1239,9 +1303,9 @@ class IsGanttBarItemPipe {
1239
1303
  return value === GanttItemType.bar;
1240
1304
  }
1241
1305
  }
1242
- IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1243
- IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1244
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
1306
+ IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1307
+ IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1308
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
1245
1309
  type: Pipe,
1246
1310
  args: [{
1247
1311
  name: 'isGanttBarItem'
@@ -1252,9 +1316,9 @@ class IsGanttCustomItemPipe {
1252
1316
  return value === GanttItemType.custom;
1253
1317
  }
1254
1318
  }
1255
- IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1256
- IsGanttCustomItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1257
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
1319
+ IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1320
+ IsGanttCustomItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1321
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
1258
1322
  type: Pipe,
1259
1323
  args: [{
1260
1324
  name: 'isGanttCustomItem'
@@ -1264,9 +1328,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1264
1328
  const defaultColumnWidth = 100;
1265
1329
  const minColumnWidth = 80;
1266
1330
  class GanttTableComponent {
1267
- constructor(gantt, elementRef) {
1331
+ constructor(gantt, ganttUpper, elementRef) {
1268
1332
  this.gantt = gantt;
1333
+ this.ganttUpper = ganttUpper;
1269
1334
  this.elementRef = elementRef;
1335
+ this.itemClick = new EventEmitter();
1270
1336
  this.ganttTableClass = true;
1271
1337
  this.ganttTableEmptyClass = false;
1272
1338
  }
@@ -1296,7 +1362,8 @@ class GanttTableComponent {
1296
1362
  expandGroup(group) {
1297
1363
  this.gantt.expandGroup(group);
1298
1364
  }
1299
- expandChildren(item) {
1365
+ expandChildren(event, item) {
1366
+ event.stopPropagation();
1300
1367
  this.gantt.expandChildren(item);
1301
1368
  }
1302
1369
  dragStarted(event) {
@@ -1370,9 +1437,9 @@ class GanttTableComponent {
1370
1437
  return item.id || index;
1371
1438
  }
1372
1439
  }
1373
- GanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttTableComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1374
- GanttTableComponent.ɵcmp = i0.ɵɵ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, 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.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1.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.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "isGanttRangeItem": IsGanttRangeItemPipe } });
1375
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttTableComponent, decorators: [{
1440
+ GanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttTableComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }, { token: GANTT_UPPER_TOKEN }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1441
+ GanttTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: GanttTableComponent, selector: "gantt-table", inputs: { groups: "groups", items: "items", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate", rowBeforeTemplate: "rowBeforeTemplate", rowAfterTemplate: "rowAfterTemplate" }, outputs: { itemClick: "itemClick" }, host: { properties: { "class.gantt-table": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass" } }, viewQueries: [{ propertyName: "draglineElementRef", first: true, predicate: ["dragLine"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"gantt-table-header gantt-table-row\">\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let i = index\" [style.width]=\"column.columnWidth\">\n <ng-container *ngIf=\"column.headerTemplateRef; else default\" [ngTemplateOutlet]=\"column.headerTemplateRef\"></ng-container>\n <ng-template #default>\n {{ column.name }}\n </ng-template>\n <div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event, column)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"columnDragEnded($event, column)\"\n ></div>\n </div>\n</div>\n<div class=\"gantt-table-body\">\n <ng-container *ngIf=\"!groups.length && !items.length\">\n <ng-container *ngIf=\"!emptyTemplate\">\n <gantt-icon class=\"empty-icon\" iconName=\"empty\"></gantt-icon>\n <div class=\"empty-text\">\u6CA1\u6709\u6570\u636E</div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"emptyTemplate\"></ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"groups && groups.length > 0; else itemsTemplate\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"group.class\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"group.expanded\" (click)=\"expandGroup(group)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"group.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.origin, group: group.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ group.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <ng-container *ngIf=\"group.expanded\">\n <ng-template\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ group: group, items: group.items, level: 0 }\"\n ></ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"tableDragEnded($event)\"\n></div>\n\n<div #dragLine class=\"gantt-table-drag-auxiliary-line\"></div>\n\n<ng-template #itemsTemplate>\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items, level: 0 }\"></ng-template>\n</ng-template>\n\n<ng-template #ganttItems let-group=\"group\" let-items=\"items\" let-level=\"level\">\n <ng-container *ngFor=\"let item of items; trackBy: trackBy\">\n <div\n (click)=\"itemClick.emit({ event: $event, selectedValue: this.item.origin })\"\n class=\"gantt-table-item gantt-table-row\"\n [class.gantt-table-item-first-level-group]=\"level === 0 && (item.type | isGanttRangeItem)\"\n [class.gantt-table-item-with-group]=\"group\"\n [class.gantt-table-item-active]=\"ganttUpper.isSelected(item.id)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n >\n <ng-template\n [ngTemplateOutlet]=\"rowBeforeTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let first = first\" [style.width]=\"column.columnWidth\">\n <div *ngIf=\"first\" class=\"gantt-expand-icon\" [style.marginLeft.px]=\"level * 20\">\n <ng-container *ngIf=\"level < gantt.maxLevel - 1 && item.expandable\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren($event, item)\"\n ></gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n <ng-template\n [ngTemplateOutlet]=\"rowAfterTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children, level: level + 1, group: group }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n", components: [{ type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1.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.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "isGanttRangeItem": IsGanttRangeItemPipe } });
1442
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttTableComponent, decorators: [{
1376
1443
  type: Component,
1377
1444
  args: [{
1378
1445
  selector: 'gantt-table',
@@ -1381,6 +1448,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1381
1448
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1382
1449
  type: Inject,
1383
1450
  args: [GANTT_ABSTRACT_TOKEN]
1451
+ }] }, { type: GanttUpper, decorators: [{
1452
+ type: Inject,
1453
+ args: [GANTT_UPPER_TOKEN]
1384
1454
  }] }, { type: i0.ElementRef }]; }, propDecorators: { groups: [{
1385
1455
  type: Input
1386
1456
  }], items: [{
@@ -1395,6 +1465,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1395
1465
  type: Input
1396
1466
  }], rowAfterTemplate: [{
1397
1467
  type: Input
1468
+ }], itemClick: [{
1469
+ type: Output
1398
1470
  }], draglineElementRef: [{
1399
1471
  type: ViewChild,
1400
1472
  args: ['dragLine', { static: true }]
@@ -1498,69 +1570,83 @@ class GanttDomService {
1498
1570
  this.unsubscribe$.complete();
1499
1571
  }
1500
1572
  }
1501
- GanttDomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1502
- GanttDomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService });
1503
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService, decorators: [{
1573
+ GanttDomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDomService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1574
+ GanttDomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDomService });
1575
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDomService, decorators: [{
1504
1576
  type: Injectable
1505
1577
  }], ctorParameters: function () { return []; } });
1506
1578
 
1579
+ function getDependencyType(path, dependencyTypes) {
1580
+ if (dependencyTypes.includes(GanttLinkType.ss) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.start) {
1581
+ return GanttLinkType.ss;
1582
+ }
1583
+ if (dependencyTypes.includes(GanttLinkType.ff) && path.from.pos === InBarPosition.finish && path.to.pos === InBarPosition.finish) {
1584
+ return GanttLinkType.ff;
1585
+ }
1586
+ if (dependencyTypes.includes(GanttLinkType.sf) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.finish) {
1587
+ return GanttLinkType.sf;
1588
+ }
1589
+ return GanttLinkType.fs;
1590
+ }
1591
+ var InBarPosition;
1592
+ (function (InBarPosition) {
1593
+ InBarPosition["start"] = "start";
1594
+ InBarPosition["finish"] = "finish";
1595
+ })(InBarPosition || (InBarPosition = {}));
1507
1596
  class GanttDragContainer {
1508
- constructor() {
1597
+ constructor(ganttUpper) {
1598
+ this.ganttUpper = ganttUpper;
1509
1599
  this.dragStarted = new EventEmitter();
1510
1600
  this.dragMoved = new EventEmitter();
1511
1601
  this.dragEnded = new EventEmitter();
1512
1602
  this.linkDragStarted = new EventEmitter();
1513
1603
  this.linkDragEntered = new EventEmitter();
1514
1604
  this.linkDragEnded = new EventEmitter();
1605
+ this.linkDragPath = { from: null, to: null };
1515
1606
  }
1516
- emitLinkDragStarted(from, item) {
1517
- this.linkDraggingId = item.id;
1518
- this.linkDragFrom = from;
1519
- this.linkDragSource = this.linkDragFrom === 'source' ? item : null;
1520
- this.linkDragTarget = this.linkDragFrom === 'target' ? item : null;
1607
+ emitLinkDragStarted(from) {
1608
+ this.linkDraggingId = from.item.id;
1609
+ this.linkDragPath.from = from;
1521
1610
  this.linkDragStarted.emit({
1522
- source: this.linkDragSource && this.linkDragSource.origin,
1523
- target: this.linkDragTarget && this.linkDragTarget.origin
1611
+ source: from.item.origin,
1612
+ target: null
1524
1613
  });
1525
1614
  }
1526
- emitLinkDragEntered(item) {
1527
- if (this.linkDragFrom === 'source') {
1528
- this.linkDragTarget = item;
1529
- }
1530
- else {
1531
- this.linkDragSource = item;
1532
- }
1615
+ emitLinkDragEntered(to) {
1616
+ this.linkDragPath.to = to;
1533
1617
  this.linkDragEntered.emit({
1534
- source: this.linkDragSource.origin,
1535
- target: this.linkDragTarget.origin
1618
+ source: this.linkDragPath.from.item.origin,
1619
+ target: to.item.origin
1536
1620
  });
1537
1621
  }
1538
1622
  emitLinkDragLeaved() {
1539
- if (this.linkDragFrom === 'source') {
1540
- this.linkDragTarget = null;
1541
- }
1542
- else {
1543
- this.linkDragSource = null;
1544
- }
1545
- }
1546
- emitLinkDragEnded() {
1623
+ this.linkDragPath.to = null;
1624
+ }
1625
+ emitLinkDragEnded(to) {
1626
+ var _a;
1627
+ this.linkDragPath.to = to;
1628
+ const dependencyType = getDependencyType(this.linkDragPath, (_a = this.ganttUpper.linkOptions) === null || _a === void 0 ? void 0 : _a.dependencyTypes);
1629
+ this.linkDragPath.from.item.addLink({
1630
+ link: this.linkDragPath.to.item.id,
1631
+ type: dependencyType
1632
+ });
1633
+ this.linkDragEnded.emit({
1634
+ source: this.linkDragPath.from.item.origin,
1635
+ target: this.linkDragPath.to.item.origin,
1636
+ type: dependencyType
1637
+ });
1547
1638
  this.linkDraggingId = null;
1548
- if (this.linkDragSource && this.linkDragTarget) {
1549
- this.linkDragSource.addLink(this.linkDragTarget.id);
1550
- this.linkDragEnded.emit({
1551
- source: this.linkDragSource.origin,
1552
- target: this.linkDragTarget.origin
1553
- });
1554
- }
1555
- this.linkDragSource = null;
1556
- this.linkDragTarget = null;
1639
+ this.linkDragPath = { from: null, to: null };
1557
1640
  }
1558
1641
  }
1559
- GanttDragContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1560
- GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer });
1561
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer, decorators: [{
1642
+ GanttDragContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDragContainer, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
1643
+ GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDragContainer });
1644
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDragContainer, decorators: [{
1562
1645
  type: Injectable
1563
- }], ctorParameters: function () { return []; } });
1646
+ }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
1647
+ type: Inject,
1648
+ args: [GANTT_UPPER_TOKEN]
1649
+ }] }]; } });
1564
1650
 
1565
1651
  class GanttPrintService {
1566
1652
  constructor() { }
@@ -1647,9 +1733,9 @@ class GanttPrintService {
1647
1733
  });
1648
1734
  }
1649
1735
  }
1650
- GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1651
- GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService });
1652
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService, decorators: [{
1736
+ GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1737
+ GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttPrintService });
1738
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttPrintService, decorators: [{
1653
1739
  type: Injectable
1654
1740
  }], ctorParameters: function () { return []; } });
1655
1741
 
@@ -1712,9 +1798,9 @@ class GanttCalendarComponent {
1712
1798
  this.unsubscribe$.complete();
1713
1799
  }
1714
1800
  }
1715
- GanttCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttCalendarComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1716
- GanttCalendarComponent.ɵcmp = i0.ɵɵ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, 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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1717
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttCalendarComponent, decorators: [{
1801
+ GanttCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttCalendarComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1802
+ GanttCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: GanttCalendarComponent, selector: "gantt-calendar-overlay", host: { properties: { "class.gantt-calendar-overlay": "this.className" } }, usesOnChanges: true, ngImport: i0, 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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1803
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttCalendarComponent, decorators: [{
1718
1804
  type: Component,
1719
1805
  args: [{
1720
1806
  selector: 'gantt-calendar-overlay',
@@ -1734,9 +1820,9 @@ class GanttDragBackdropComponent {
1734
1820
  }
1735
1821
  ngOnInit() { }
1736
1822
  }
1737
- GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1738
- GanttDragBackdropComponent.ɵcmp = i0.ɵɵ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, 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" });
1739
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
1823
+ GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1824
+ GanttDragBackdropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop", host: { properties: { "class.gantt-drag-backdrop": "this.backdropClass" } }, ngImport: i0, 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" });
1825
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
1740
1826
  type: Component,
1741
1827
  args: [{
1742
1828
  selector: 'gantt-drag-backdrop',
@@ -1829,9 +1915,9 @@ class NgxGanttRootComponent {
1829
1915
  this.dom.scrollMainContainer(x);
1830
1916
  }
1831
1917
  }
1832
- NgxGanttRootComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttRootComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: GanttDomService }, { token: GanttDragContainer }, { token: GANTT_UPPER_TOKEN }, { token: GanttPrintService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1833
- NgxGanttRootComponent.ɵcmp = i0.ɵɵ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, 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.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
1834
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
1918
+ NgxGanttRootComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttRootComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: GanttDomService }, { token: GanttDragContainer }, { token: GANTT_UPPER_TOKEN }, { token: GanttPrintService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1919
+ NgxGanttRootComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", 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, 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.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
1920
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
1835
1921
  type: Component,
1836
1922
  args: [{
1837
1923
  selector: 'ngx-gantt-root',
@@ -1856,6 +1942,186 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1856
1942
  args: ['mainTemplate', { static: true }]
1857
1943
  }] } });
1858
1944
 
1945
+ class GanttLinkLine {
1946
+ constructor() { }
1947
+ generatePath(source, target, type) {
1948
+ if (source.before && source.after && target.before && target.after) {
1949
+ let path = '';
1950
+ switch (type) {
1951
+ case GanttLinkType.ss:
1952
+ path = this.generateSSPath(source, target);
1953
+ break;
1954
+ case GanttLinkType.ff:
1955
+ path = this.generateFFPath(source, target);
1956
+ break;
1957
+ case GanttLinkType.sf:
1958
+ path = this.generateFSAndSFPath(source, target, type);
1959
+ break;
1960
+ default:
1961
+ path = this.generateFSAndSFPath(source, target);
1962
+ }
1963
+ return path;
1964
+ }
1965
+ }
1966
+ }
1967
+
1968
+ let GanttLinkLineCurve = class GanttLinkLineCurve extends GanttLinkLine {
1969
+ constructor(ganttUpper) {
1970
+ super();
1971
+ this.ganttUpper = ganttUpper;
1972
+ }
1973
+ generateSSPath(source, target) {
1974
+ const x1 = source.before.x;
1975
+ const y1 = source.before.y;
1976
+ const x4 = target.before.x;
1977
+ const y4 = target.before.y;
1978
+ const isMirror = y4 > y1 ? 0 : 1;
1979
+ const radius = Math.abs(y4 - y1) / 2;
1980
+ if (x4 > x1) {
1981
+ return `M ${x1} ${y1}
1982
+ A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
1983
+ L ${x4} ${y4}`;
1984
+ }
1985
+ else {
1986
+ return `M ${x1} ${y1}
1987
+ L ${x4} ${y1}
1988
+ A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
1989
+ }
1990
+ }
1991
+ generateFFPath(source, target) {
1992
+ const x1 = source.after.x;
1993
+ const y1 = source.after.y;
1994
+ const x4 = target.after.x;
1995
+ const y4 = target.after.y;
1996
+ const isMirror = y4 > y1 ? 1 : 0;
1997
+ const radius = Math.abs(y4 - y1) / 2;
1998
+ if (x4 > x1) {
1999
+ return `M ${x1} ${y1}
2000
+ L ${x4} ${y1}
2001
+ A ${radius} ${radius} 0 1 ${isMirror} ${x4} ${y4}`;
2002
+ }
2003
+ else {
2004
+ return `M ${x1} ${y1}
2005
+ A ${radius} ${radius} 0 1 ${isMirror} ${x1} ${y4}
2006
+ L ${x4} ${y4}`;
2007
+ }
2008
+ }
2009
+ generateFSAndSFPath(source, target, type) {
2010
+ var _a;
2011
+ let x1 = source.after.x;
2012
+ let y1 = source.after.y;
2013
+ let x4 = target.before.x;
2014
+ let y4 = target.before.y;
2015
+ const bezierWeight = 0.5;
2016
+ if (type === GanttLinkType.sf) {
2017
+ x1 = target.after.x;
2018
+ y1 = target.after.y;
2019
+ x4 = source.before.x;
2020
+ y4 = source.before.y;
2021
+ }
2022
+ let dx = Math.abs(x4 - x1) * bezierWeight;
2023
+ let x2 = x1 + dx;
2024
+ let x3 = x4 - dx;
2025
+ const centerX = (x1 + x4) / 2;
2026
+ const centerY = (y1 + y4) / 2;
2027
+ let controlX = this.ganttUpper.styles.lineHeight / 2;
2028
+ const controlY = this.ganttUpper.styles.lineHeight / 2;
2029
+ if (x1 >= x4) {
2030
+ if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
2031
+ return `M ${x1} ${y1}
2032
+ C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${x1} ${y4 > y1 ? y1 + controlY : y1 - controlY}
2033
+ L ${x4} ${y4 > y1 ? y4 - controlY : y4 + controlY}
2034
+ C ${x4 - controlY} ${y4 > y1 ? y4 - controlY : y4 + controlY} ${x4 - controlX} ${y4} ${x4} ${y4}
2035
+ `;
2036
+ }
2037
+ else {
2038
+ controlX = this.ganttUpper.styles.lineHeight;
2039
+ return `M ${x1} ${y1}
2040
+ C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${centerX} ${centerY}
2041
+ C ${x4 - controlX} ${y4 > y1 ? y4 - controlX : y4 + controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
2042
+ `;
2043
+ }
2044
+ }
2045
+ else if (((_a = this.ganttUpper.linkOptions) === null || _a === void 0 ? void 0 : _a.showArrow) && x4 - x1 < 200) {
2046
+ dx = Math.max(Math.abs(y4 - y1) * bezierWeight, 60);
2047
+ x2 = x1 + dx;
2048
+ x3 = x4 - dx;
2049
+ return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
2050
+ }
2051
+ return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
2052
+ }
2053
+ };
2054
+ GanttLinkLineCurve = __decorate([
2055
+ __param(0, Inject(GANTT_UPPER_TOKEN))
2056
+ ], GanttLinkLineCurve);
2057
+
2058
+ class GanttLinkLineStraight extends GanttLinkLine {
2059
+ constructor() {
2060
+ super();
2061
+ this.pathControl = 20;
2062
+ }
2063
+ generateSSPath(source, target) {
2064
+ const x1 = source.before.x;
2065
+ const y1 = source.before.y;
2066
+ const x4 = target.before.x;
2067
+ const y4 = target.before.y;
2068
+ const control = this.pathControl;
2069
+ return `M ${x1} ${y1}
2070
+ L ${x4 > x1 ? x1 - control : x4 - control} ${y1}
2071
+ L ${x4 > x1 ? x1 - control : x4 - control} ${y4}
2072
+ L ${x4} ${y4}`;
2073
+ }
2074
+ generateFFPath(source, target) {
2075
+ const x1 = source.after.x;
2076
+ const y1 = source.after.y;
2077
+ const x4 = target.after.x;
2078
+ const y4 = target.after.y;
2079
+ const control = this.pathControl;
2080
+ return `M ${x1} ${y1}
2081
+ L ${x4 > x1 ? x4 + control : x1 + control} ${y1}
2082
+ L ${x4 > x1 ? x4 + control : x1 + control} ${y4}
2083
+ L ${x4} ${y4}`;
2084
+ }
2085
+ generateFSAndSFPath(source, target, type) {
2086
+ let x1 = source.after.x;
2087
+ let y1 = source.after.y;
2088
+ let x4 = target.before.x;
2089
+ let y4 = target.before.y;
2090
+ const control = this.pathControl;
2091
+ if (type === GanttLinkType.sf) {
2092
+ x1 = target.after.x;
2093
+ y1 = target.after.y;
2094
+ x4 = source.before.x;
2095
+ y4 = source.before.y;
2096
+ }
2097
+ if (x4 - x1 >= 40) {
2098
+ return `M ${x1} ${y1}
2099
+ L ${x1 + control} ${y1}
2100
+ L ${x1 + control} ${y4}
2101
+ L ${x4} ${y4}`;
2102
+ }
2103
+ else {
2104
+ return `M ${x1} ${y1}
2105
+ L ${x1 + control} ${y1}
2106
+ L ${x1 + control} ${y4 > y1 ? y1 + control : y1 - control}
2107
+ L ${x4 - control} ${y4 > y1 ? y1 + control : y1 - control}
2108
+ L ${x4 - control} ${y4}
2109
+ L ${x4} ${y4}`;
2110
+ }
2111
+ }
2112
+ }
2113
+
2114
+ function createLineGenerator(type, ganttUpper) {
2115
+ switch (type) {
2116
+ case GanttLinkLineType.curve:
2117
+ return new GanttLinkLineCurve(ganttUpper);
2118
+ case GanttLinkLineType.straight:
2119
+ return new GanttLinkLineStraight();
2120
+ default:
2121
+ throw new Error('gantt link path type invalid');
2122
+ }
2123
+ }
2124
+
1859
2125
  class GanttLinksComponent {
1860
2126
  constructor(ganttUpper, cdr, elementRef, ganttDragContainer) {
1861
2127
  this.ganttUpper = ganttUpper;
@@ -1866,20 +2132,23 @@ class GanttLinksComponent {
1866
2132
  this.items = [];
1867
2133
  this.lineClick = new EventEmitter();
1868
2134
  this.links = [];
2135
+ this.ganttLinkTypes = GanttLinkType;
2136
+ this.showArrow = false;
1869
2137
  this.linkItems = [];
1870
- this.bezierWeight = -0.5;
1871
2138
  this.firstChange = true;
1872
2139
  this.unsubscribe$ = new Subject();
1873
2140
  this.ganttLinksOverlay = true;
1874
2141
  }
1875
2142
  ngOnInit() {
2143
+ this.linkLine = createLineGenerator(this.ganttUpper.linkOptions.lineType, this.ganttUpper);
2144
+ this.showArrow = this.ganttUpper.linkOptions.showArrow;
1876
2145
  this.buildLinks();
1877
2146
  this.firstChange = false;
1878
2147
  this.ganttDragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1879
2148
  this.elementRef.nativeElement.style.visibility = 'hidden';
1880
2149
  });
1881
2150
  merge(this.ganttUpper.viewChange, this.ganttUpper.expandChange, this.ganttUpper.view.start$, this.ganttUpper.dragEnded, this.ganttUpper.linkDragEnded)
1882
- .pipe(takeUntil(this.unsubscribe$), skip(1))
2151
+ .pipe(takeUntil(this.unsubscribe$), skip(1), debounceTime(0))
1883
2152
  .subscribe(() => {
1884
2153
  this.elementRef.nativeElement.style.visibility = 'visible';
1885
2154
  this.buildLinks();
@@ -1930,105 +2199,6 @@ class GanttLinksComponent {
1930
2199
  });
1931
2200
  }
1932
2201
  }
1933
- generatePath(source, target, type) {
1934
- if (source.before && source.after && target.before && target.after) {
1935
- let x1 = source.after.x;
1936
- let y1 = source.after.y;
1937
- let x4 = target.before.x;
1938
- let y4 = target.before.y;
1939
- let isMirror;
1940
- const control = Math.abs(y4 - y1) / 2;
1941
- switch (type) {
1942
- case GanttLinkType.ss:
1943
- x1 = source.before.x;
1944
- y1 = source.before.y;
1945
- x4 = target.before.x;
1946
- y4 = target.before.y;
1947
- isMirror = y4 > y1 ? 0 : 1;
1948
- if (x4 > x1) {
1949
- return `M ${x1} ${y1}
1950
- A ${control} ${control} 0 1 ${isMirror} ${x1} ${y4}
1951
- L ${x1} ${y4} ${x4} ${y4}`;
1952
- }
1953
- else {
1954
- return `M ${x1} ${y1}
1955
- L ${x1} ${y1} ${x4} ${y1}
1956
- A ${control} ${control} 0 1 ${isMirror} ${x4} ${y4}`;
1957
- }
1958
- case GanttLinkType.ff:
1959
- x1 = source.after.x;
1960
- y1 = source.after.y;
1961
- x4 = target.after.x;
1962
- y4 = target.after.y;
1963
- isMirror = y4 > y1 ? 1 : 0;
1964
- if (x4 > x1) {
1965
- return `M ${x1} ${y1}
1966
- L ${x1} ${y1} ${x4} ${y1}
1967
- A ${control} ${control} 0 1 ${isMirror} ${x4} ${y4}`;
1968
- }
1969
- else {
1970
- return `M ${x1} ${y1}
1971
- A ${control} ${control} 0 1 ${isMirror} ${x1} ${y4}
1972
- L ${x1} ${y4} ${x4} ${y4}`;
1973
- }
1974
- case GanttLinkType.sf:
1975
- x1 = target.after.x;
1976
- y1 = target.after.y;
1977
- x4 = source.before.x;
1978
- y4 = source.before.y;
1979
- }
1980
- const dx = Math.abs(x4 - x1) * this.bezierWeight;
1981
- const x2 = x1 - dx;
1982
- const x3 = x4 + dx;
1983
- const centerX = (x1 + x4) / 2;
1984
- const centerY = (y1 + y4) / 2;
1985
- let controlX = this.ganttUpper.styles.lineHeight / 2;
1986
- const controlY = this.ganttUpper.styles.lineHeight / 2;
1987
- if (x1 >= x4) {
1988
- if (y4 > y1) {
1989
- if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
1990
- return `M ${x1} ${y1}
1991
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 + controlX} ${x1} ${y1 + controlY}
1992
- L ${x1} ${y1 + controlY} ${centerX} ${centerY}
1993
-
1994
- M ${x4} ${y4}
1995
- C ${x4 - controlX} ${y4} ${x4 - controlX} ${y4 - controlX} ${x4} ${y4 - controlY}
1996
- L ${x4} ${y4 - controlY} ${centerX} ${centerY}`;
1997
- }
1998
- else {
1999
- controlX = this.ganttUpper.styles.lineHeight;
2000
- return `M ${x1} ${y1}
2001
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 + controlX} ${centerX} ${centerY}
2002
-
2003
-
2004
- M ${x4} ${y4}
2005
- C ${x4 - controlX} ${y4} ${x4 - controlX} ${y4 - controlX} ${centerX} ${centerY}`;
2006
- }
2007
- }
2008
- else {
2009
- if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
2010
- return `M ${x1} ${y1}
2011
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 - controlX} ${x1} ${y1 - controlY}
2012
- L ${x1} ${y1 - controlY} ${centerX} ${centerY}
2013
-
2014
- M ${x4} ${y4}
2015
- C ${x4 - controlX} ${y4} ${x4 - controlX} ${y4 + controlX} ${x4} ${y4 + controlY}
2016
- L ${x4} ${y4 + controlY} ${centerX} ${centerY}
2017
- `;
2018
- }
2019
- else {
2020
- controlX = this.ganttUpper.styles.lineHeight;
2021
- return `M ${x1} ${y1}
2022
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 - controlX} ${centerX} ${centerY}
2023
-
2024
- M ${x4} ${y4}
2025
- C ${x4 - controlX} ${y4} ${x4 - controlX} ${y4 + controlX} ${centerX} ${centerY}`;
2026
- }
2027
- }
2028
- }
2029
- return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
2030
- }
2031
- }
2032
2202
  buildLinks() {
2033
2203
  this.computeItemPosition();
2034
2204
  this.links = [];
@@ -2037,12 +2207,30 @@ class GanttLinksComponent {
2037
2207
  source.links.forEach((link) => {
2038
2208
  const target = this.linkItems.find((item) => item.id === link.link);
2039
2209
  if (target && (target.origin.start || target.origin.end)) {
2210
+ let defaultColor = LinkColors.default;
2211
+ let activeColor = LinkColors.active;
2212
+ if (link.type === GanttLinkType.fs && source.end.getTime() > target.start.getTime()) {
2213
+ defaultColor = LinkColors.blocked;
2214
+ activeColor = LinkColors.blocked;
2215
+ }
2216
+ if (link.color) {
2217
+ if (typeof link.color === 'string') {
2218
+ defaultColor = link.color;
2219
+ activeColor = link.color;
2220
+ }
2221
+ else {
2222
+ defaultColor = link.color.default;
2223
+ activeColor = link.color.active;
2224
+ }
2225
+ }
2040
2226
  this.links.push({
2041
- path: this.generatePath(source, target, link.type),
2227
+ path: this.linkLine.generatePath(source, target, link.type),
2042
2228
  source: source.origin,
2043
2229
  target: target.origin,
2044
2230
  type: link.type,
2045
- color: source.end.getTime() > target.start.getTime() ? LinkColors.blocked : LinkColors.default
2231
+ color: defaultColor,
2232
+ defaultColor,
2233
+ activeColor
2046
2234
  });
2047
2235
  }
2048
2236
  });
@@ -2059,24 +2247,24 @@ class GanttLinksComponent {
2059
2247
  target: link.target
2060
2248
  });
2061
2249
  }
2062
- mouseEnterPath(link) {
2063
- if (link.color === LinkColors.default) {
2064
- link.color = LinkColors.active;
2250
+ mouseEnterPath(link, index) {
2251
+ link.color = link.activeColor || link.defaultColor;
2252
+ if (index < this.links.length - 1) {
2253
+ this.links.splice(index, 1);
2254
+ this.links.push(link);
2065
2255
  }
2066
2256
  }
2067
2257
  mouseLeavePath(link) {
2068
- if (link.color === LinkColors.active) {
2069
- link.color = LinkColors.default;
2070
- }
2258
+ link.color = link.defaultColor;
2071
2259
  }
2072
2260
  ngOnDestroy() {
2073
2261
  this.unsubscribe$.next();
2074
2262
  this.unsubscribe$.complete();
2075
2263
  }
2076
2264
  }
2077
- GanttLinksComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttLinksComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: GanttDragContainer }], target: i0.ɵɵFactoryTarget.Component });
2078
- GanttLinksComponent.ɵcmp = i0.ɵɵ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, template: "<svg [attr.width]=\"ganttUpper.view.width\" class=\"gantt-links-overlay-main\">\n <ng-container *ngFor=\"let link of links; let i = index; trackBy: trackBy\">\n <path\n [attr.d]=\"link.path\"\n fill=\"transparent\"\n stroke-width=\"2\"\n [attr.stroke]=\"link.color\"\n pointer-events=\"none\"\n [style]=\"'marker-end: url(#triangle' + i + ')'\"\n ></path>\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n (mouseenter)=\"mouseEnterPath(link)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n [attr.d]=\"link.path\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n <!-- <defs>\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"auto\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n </defs> -->\n </ng-container>\n <line class=\"link-dragging-line\"></line>\n</svg>\n", directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
2079
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttLinksComponent, decorators: [{
2265
+ GanttLinksComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttLinksComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: GanttDragContainer }], target: i0.ɵɵFactoryTarget.Component });
2266
+ GanttLinksComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", 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, template: "<svg [attr.width]=\"ganttUpper.view.width\" class=\"gantt-links-overlay-main\">\n <ng-container *ngFor=\"let link of links; let i = index; trackBy: trackBy\">\n <path\n [attr.d]=\"link.path\"\n fill=\"transparent\"\n stroke-width=\"2\"\n [attr.stroke]=\"link.color\"\n pointer-events=\"none\"\n [attr.style]=\"link.type === ganttLinkTypes.sf ? 'marker-start: url(#triangle' + i + ')' : 'marker-end: url(#triangle' + i + ')'\"\n ></path>\n\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n [attr.d]=\"link.path\"\n (mouseenter)=\"mouseEnterPath(link, i)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n <defs *ngIf=\"showArrow\">\n <marker\n *ngIf=\"link.type === ganttLinkTypes.sf; else markerEnd\"\n [id]=\"'triangle' + i\"\n markerUnits=\"strokeWidth\"\n markerWidth=\"5\"\n markerHeight=\"4\"\n refX=\"5\"\n refY=\"2\"\n orient=\"180\"\n >\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n\n <ng-template #markerEnd>\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"auto\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n </ng-template>\n </defs>\n </ng-container>\n <line class=\"link-dragging-line\"></line>\n</svg>\n", directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2267
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttLinksComponent, decorators: [{
2080
2268
  type: Component,
2081
2269
  args: [{
2082
2270
  selector: 'gantt-links-overlay',
@@ -2133,9 +2321,9 @@ class GanttItemUpper {
2133
2321
  this.unsubscribe$.complete();
2134
2322
  }
2135
2323
  }
2136
- GanttItemUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttItemUpper, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Directive });
2137
- GanttItemUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.2", type: GanttItemUpper, inputs: { template: "template", item: "item" }, ngImport: i0 });
2138
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttItemUpper, decorators: [{
2324
+ GanttItemUpper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttItemUpper, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Directive });
2325
+ GanttItemUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.5", type: GanttItemUpper, inputs: { template: "template", item: "item" }, ngImport: i0 });
2326
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttItemUpper, decorators: [{
2139
2327
  type: Directive
2140
2328
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2141
2329
  type: Inject,
@@ -2161,9 +2349,9 @@ class NgxGanttRangeComponent extends GanttItemUpper {
2161
2349
  super.onDestroy();
2162
2350
  }
2163
2351
  }
2164
- NgxGanttRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttRangeComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2165
- NgxGanttRangeComponent.ɵcmp = i0.ɵɵ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, 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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2166
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2352
+ NgxGanttRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttRangeComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2353
+ NgxGanttRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range", host: { properties: { "class.gantt-range": "this.ganttRangeClass" } }, usesInheritance: true, usesOnChanges: true, ngImport: i0, 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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2354
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2167
2355
  type: Component,
2168
2356
  args: [{
2169
2357
  selector: 'ngx-gantt-range,gantt-range',
@@ -2179,7 +2367,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2179
2367
 
2180
2368
  const dragMinWidth = 10;
2181
2369
  const activeClass = 'gantt-bar-active';
2182
- const linkDropClass = 'gantt-bar-link-drop';
2370
+ const dropActiveClass = 'gantt-bar-drop-active';
2371
+ const singleDropActiveClass = 'gantt-bar-single-drop-active';
2183
2372
  function createSvgElement(qualifiedName, className) {
2184
2373
  const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
2185
2374
  element.classList.add(className);
@@ -2200,13 +2389,21 @@ class GanttBarDrag {
2200
2389
  return !this.item.linkable || !this.ganttUpper.linkable;
2201
2390
  }
2202
2391
  createMouseEvents() {
2392
+ var _a, _b, _c;
2393
+ const dropClass = ((_b = (_a = this.ganttUpper.config.linkOptions) === null || _a === void 0 ? void 0 : _a.dependencyTypes) === null || _b === void 0 ? void 0 : _b.length) === 1 &&
2394
+ ((_c = this.ganttUpper.config.linkOptions) === null || _c === void 0 ? void 0 : _c.dependencyTypes[0]) === GanttLinkType.fs
2395
+ ? singleDropActiveClass
2396
+ : dropActiveClass;
2203
2397
  fromEvent(this.barElement, 'mouseenter')
2204
2398
  .pipe(takeUntil(this.destroy$))
2205
- .subscribe(() => {
2399
+ .subscribe((event) => {
2206
2400
  if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
2207
2401
  if (this.item.linkable) {
2208
- this.barElement.classList.add(linkDropClass);
2209
- this.dragContainer.emitLinkDragEntered(this.item);
2402
+ this.barElement.classList.add(dropClass);
2403
+ this.dragContainer.emitLinkDragEntered({
2404
+ item: this.item,
2405
+ element: this.barElement
2406
+ });
2210
2407
  }
2211
2408
  }
2212
2409
  else {
@@ -2215,14 +2412,14 @@ class GanttBarDrag {
2215
2412
  });
2216
2413
  fromEvent(this.barElement, 'mouseleave')
2217
2414
  .pipe(takeUntil(this.destroy$))
2218
- .subscribe(() => {
2415
+ .subscribe((event) => {
2219
2416
  if (!this.dragContainer.linkDraggingId) {
2220
2417
  this.barElement.classList.remove(activeClass);
2221
2418
  }
2222
2419
  else {
2223
2420
  this.dragContainer.emitLinkDragLeaved();
2224
2421
  }
2225
- this.barElement.classList.remove(linkDropClass);
2422
+ this.barElement.classList.remove(dropClass);
2226
2423
  });
2227
2424
  }
2228
2425
  createBarDrag() {
@@ -2233,19 +2430,22 @@ class GanttBarDrag {
2233
2430
  this.dragContainer.dragStarted.emit({ item: this.item.origin });
2234
2431
  });
2235
2432
  dragRef.moved.subscribe((event) => {
2236
- const x = this.item.refs.x + event.distance.x;
2237
- const days = differenceInCalendarDays(this.item.end.value, this.item.start.value);
2238
- const start = this.ganttUpper.view.getDateByXPoint(x);
2239
- const end = start.addDays(days);
2240
- this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(x), end);
2433
+ const currentX = this.item.refs.x + event.distance.x;
2434
+ const currentDate = this.ganttUpper.view.getDateByXPoint(currentX);
2435
+ const currentStartX = this.ganttUpper.view.getXPointByDate(currentDate);
2436
+ const dayWidth = this.ganttUpper.view.getDayOccupancyWidth(currentDate);
2437
+ const diffDays = differenceInCalendarDays(this.item.end.value, this.item.start.value);
2438
+ let start = currentDate;
2439
+ let end = currentDate.addDays(diffDays);
2440
+ if (currentX > currentStartX + dayWidth / 2) {
2441
+ start = start.addDays(1);
2442
+ end = end.addDays(1);
2443
+ }
2444
+ this.openDragBackdrop(this.barElement, start, end);
2241
2445
  this.item.updateDate(start, end);
2242
2446
  this.dragContainer.dragMoved.emit({ item: this.item.origin });
2243
2447
  });
2244
2448
  dragRef.ended.subscribe((event) => {
2245
- const days = differenceInCalendarDays(this.item.end.value, this.item.start.value);
2246
- const start = this.ganttUpper.view.getDateByXPoint(this.item.refs.x + event.distance.x);
2247
- const end = start.addDays(days);
2248
- this.item.updateDate(start, end);
2249
2449
  this.clearDraggingStyles();
2250
2450
  this.closeDragBackdrop();
2251
2451
  event.source.reset();
@@ -2319,7 +2519,7 @@ class GanttBarDrag {
2319
2519
  const dragRefs = [];
2320
2520
  const handles = this.barElement.querySelectorAll('.link-handles .handle');
2321
2521
  handles.forEach((handle, index) => {
2322
- const isBefore = index === 0;
2522
+ const isBegin = index === 0;
2323
2523
  const dragRef = this.dragDrop.createDrag(handle);
2324
2524
  dragRef.withBoundaryElement(this.dom.root);
2325
2525
  dragRef.beforeStarted.subscribe(() => {
@@ -2328,24 +2528,35 @@ class GanttBarDrag {
2328
2528
  this.barDragRef.disabled = true;
2329
2529
  }
2330
2530
  this.createLinkDraggingLine();
2331
- this.dragContainer.emitLinkDragStarted(isBefore ? 'target' : 'source', this.item);
2531
+ this.dragContainer.emitLinkDragStarted({
2532
+ element: this.barElement,
2533
+ item: this.item,
2534
+ pos: isBegin ? InBarPosition.start : InBarPosition.finish
2535
+ });
2332
2536
  });
2333
2537
  dragRef.moved.subscribe(() => {
2334
- const positions = this.calcLinkLinePositions(handle, isBefore);
2538
+ const positions = this.calcLinkLinePositions(handle, isBegin);
2335
2539
  this.linkDraggingLine.setAttribute('x1', positions.x1.toString());
2336
2540
  this.linkDraggingLine.setAttribute('y1', positions.y1.toString());
2337
2541
  this.linkDraggingLine.setAttribute('x2', positions.x2.toString());
2338
2542
  this.linkDraggingLine.setAttribute('y2', positions.y2.toString());
2339
2543
  });
2340
2544
  dragRef.ended.subscribe((event) => {
2341
- event.source.reset();
2342
2545
  handle.style.pointerEvents = '';
2343
2546
  if (this.barDragRef) {
2344
2547
  this.barDragRef.disabled = false;
2345
2548
  }
2549
+ // 计算line拖动的落点位于目标Bar的值,如果值大于Bar宽度的一半,说明是拖动到Begin位置,否则则为拖动到End位置
2550
+ if (this.dragContainer.linkDragPath.to) {
2551
+ const placePointX = event.source.getRootElement().getBoundingClientRect().x -
2552
+ this.dragContainer.linkDragPath.to.element.getBoundingClientRect().x;
2553
+ this.dragContainer.emitLinkDragEnded(Object.assign(Object.assign({}, this.dragContainer.linkDragPath.to), { pos: placePointX < this.dragContainer.linkDragPath.to.item.refs.width / 2
2554
+ ? InBarPosition.start
2555
+ : InBarPosition.finish }));
2556
+ }
2557
+ event.source.reset();
2346
2558
  this.barElement.classList.remove(activeClass);
2347
2559
  this.destroyLinkDraggingLine();
2348
- this.dragContainer.emitLinkDragEnded();
2349
2560
  });
2350
2561
  dragRefs.push(dragRef);
2351
2562
  });
@@ -2394,6 +2605,7 @@ class GanttBarDrag {
2394
2605
  if (!this.linkDraggingLine) {
2395
2606
  const svgElement = createSvgElement('svg', 'gantt-link-drag-container');
2396
2607
  const linElement = createSvgElement('line', 'link-dragging-line');
2608
+ linElement.style.pointerEvents = 'none';
2397
2609
  svgElement.appendChild(linElement);
2398
2610
  this.dom.root.appendChild(svgElement);
2399
2611
  this.linkDraggingLine = linElement;
@@ -2432,9 +2644,9 @@ class GanttBarDrag {
2432
2644
  this.destroy$.complete();
2433
2645
  }
2434
2646
  }
2435
- GanttBarDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttBarDrag, deps: [{ token: i1.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }], target: i0.ɵɵFactoryTarget.Injectable });
2436
- GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttBarDrag });
2437
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttBarDrag, decorators: [{
2647
+ GanttBarDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttBarDrag, deps: [{ token: i1.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }], target: i0.ɵɵFactoryTarget.Injectable });
2648
+ GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttBarDrag });
2649
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttBarDrag, decorators: [{
2438
2650
  type: Injectable
2439
2651
  }], ctorParameters: function () { return [{ type: i1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }]; } });
2440
2652
 
@@ -2502,9 +2714,9 @@ class NgxGanttBarComponent extends GanttItemUpper {
2502
2714
  super.onDestroy();
2503
2715
  }
2504
2716
  }
2505
- NgxGanttBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttBarComponent, deps: [{ token: GanttDragContainer }, { token: GanttBarDrag }, { token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2506
- NgxGanttBarComponent.ɵcmp = i0.ɵɵ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, 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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2507
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
2717
+ NgxGanttBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttBarComponent, deps: [{ token: GanttDragContainer }, { token: GanttBarDrag }, { token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2718
+ NgxGanttBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", 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, 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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2719
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
2508
2720
  type: Component,
2509
2721
  args: [{
2510
2722
  selector: 'ngx-gantt-bar,gantt-bar',
@@ -2536,9 +2748,9 @@ class GanttMainComponent {
2536
2748
  return item.id || index;
2537
2749
  }
2538
2750
  }
2539
- GanttMainComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttMainComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2540
- GanttMainComponent.ɵcmp = i0.ɵɵ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, 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.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "isGanttCustomItem": IsGanttCustomItemPipe, "isGanttRangeItem": IsGanttRangeItemPipe, "isGanttBarItem": IsGanttBarItemPipe } });
2541
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttMainComponent, decorators: [{
2751
+ GanttMainComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttMainComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
2752
+ GanttMainComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", 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, template: "<gantt-links-overlay [groups]=\"groups\" [items]=\"items\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<!-- groups -->\n<div class=\"gantt-main-groups\" *ngIf=\"groups && groups.length > 0; else itemsTemplate\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"group.class\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: group }\"></ng-template>\n </div>\n <div *ngIf=\"group.expanded\" class=\"gantt-items\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: group.items }\"></ng-template>\n </div>\n </ng-container>\n</div>\n<!-- items -->\n<ng-template #itemsTemplate>\n <div class=\"gantt-main-items\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items }\"></ng-template>\n </div>\n</ng-template>\n\n<ng-template #ganttItems let-items=\"items\">\n <ng-container *ngFor=\"let item of items;\">\n <div\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(item.id)\"\n >\n <ng-container *ngIf=\"item.type | isGanttCustomItem\">\n <ng-template [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n </ng-container>\n <gantt-range *ngIf=\"item.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"item\"></gantt-range>\n <gantt-bar *ngIf=\"item.type | isGanttBarItem\" [item]=\"item\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n", components: [{ type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: ["groups", "items"], outputs: ["lineClick"] }, { type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range" }, { type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: ["barClick"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "isGanttCustomItem": IsGanttCustomItemPipe, "isGanttRangeItem": IsGanttRangeItemPipe, "isGanttBarItem": IsGanttBarItemPipe } });
2753
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttMainComponent, decorators: [{
2542
2754
  type: Component,
2543
2755
  args: [{
2544
2756
  selector: 'gantt-main',
@@ -2575,6 +2787,7 @@ class NgxGanttComponent extends GanttUpper {
2575
2787
  this.linkDragStarted = new EventEmitter();
2576
2788
  this.linkDragEnded = new EventEmitter();
2577
2789
  this.lineClick = new EventEmitter();
2790
+ this.selectedChange = new EventEmitter();
2578
2791
  this.ngUnsubscribe$ = new Subject();
2579
2792
  this.sideTableWidth = sideWidth;
2580
2793
  }
@@ -2628,12 +2841,29 @@ class NgxGanttComponent extends GanttUpper {
2628
2841
  this.expandChange.emit();
2629
2842
  }
2630
2843
  }
2844
+ selectItem(selectEvent) {
2845
+ var _a;
2846
+ if (!this.selectable) {
2847
+ return;
2848
+ }
2849
+ const { event, selectedValue } = selectEvent;
2850
+ this.selectionModel.toggle(selectedValue.id);
2851
+ const selectedIds = this.selectionModel.selected;
2852
+ if (this.multiple) {
2853
+ const _selectedValue = this.getGanttItems(selectedIds).map((item) => item.origin);
2854
+ this.selectedChange.emit({ event, selectedValue: _selectedValue });
2855
+ }
2856
+ else {
2857
+ const _selectedValue = (_a = this.getGanttItem(selectedIds[0])) === null || _a === void 0 ? void 0 : _a.origin;
2858
+ this.selectedChange.emit({ event, selectedValue: _selectedValue });
2859
+ }
2860
+ }
2631
2861
  ngOnDestroy() {
2632
2862
  super.onDestroy();
2633
2863
  }
2634
2864
  }
2635
- NgxGanttComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
2636
- NgxGanttComponent.ɵcmp = i0.ɵɵ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: [
2865
+ NgxGanttComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Component });
2866
+ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick", selectedChange: "selectedChange" }, providers: [
2637
2867
  {
2638
2868
  provide: GANTT_UPPER_TOKEN,
2639
2869
  useExisting: NgxGanttComponent
@@ -2642,8 +2872,8 @@ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
2642
2872
  provide: GANTT_ABSTRACT_TOKEN,
2643
2873
  useExisting: forwardRef(() => NgxGanttComponent)
2644
2874
  }
2645
- ], 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, 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.ChangeDetectionStrategy.OnPush });
2646
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttComponent, decorators: [{
2875
+ ], 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, template: "<ngx-gantt-root>\n <ng-template #sideTemplate>\n <gantt-table\n [groups]=\"groups\"\n [items]=\"items\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n (itemClick)=\"selectItem($event)\"\n ></gantt-table>\n </ng-template>\n <ng-template #mainTemplate>\n <gantt-main\n [groups]=\"groups\"\n [items]=\"items\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </ng-template>\n</ngx-gantt-root>\n", components: [{ type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }, { type: GanttTableComponent, selector: "gantt-table", inputs: ["groups", "items", "columns", "groupTemplate", "emptyTemplate", "rowBeforeTemplate", "rowAfterTemplate"], outputs: ["itemClick"] }, { type: GanttMainComponent, selector: "gantt-main", inputs: ["groups", "items", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2876
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttComponent, decorators: [{
2647
2877
  type: Component,
2648
2878
  args: [{
2649
2879
  selector: 'ngx-gantt',
@@ -2677,6 +2907,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2677
2907
  type: Output
2678
2908
  }], lineClick: [{
2679
2909
  type: Output
2910
+ }], selectedChange: [{
2911
+ type: Output
2680
2912
  }], table: [{
2681
2913
  type: ContentChild,
2682
2914
  args: [NgxGanttTableComponent]
@@ -2690,8 +2922,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2690
2922
 
2691
2923
  class NgxGanttModule {
2692
2924
  }
2693
- NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2694
- NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
2925
+ NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2926
+ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
2695
2927
  NgxGanttTableComponent,
2696
2928
  NgxGanttTableColumnComponent,
2697
2929
  GanttTableComponent,
@@ -2711,13 +2943,13 @@ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version:
2711
2943
  NgxGanttRootComponent,
2712
2944
  NgxGanttBarComponent,
2713
2945
  NgxGanttRangeComponent] });
2714
- NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, providers: [
2946
+ NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttModule, providers: [
2715
2947
  {
2716
2948
  provide: GANTT_GLOBAL_CONFIG,
2717
2949
  useValue: defaultConfig
2718
2950
  }
2719
2951
  ], imports: [[CommonModule, DragDropModule]] });
2720
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, decorators: [{
2952
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttModule, decorators: [{
2721
2953
  type: NgModule,
2722
2954
  args: [{
2723
2955
  imports: [CommonModule, DragDropModule],
@@ -2763,5 +2995,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2763
2995
  * Generated bundle index. Do not edit.
2764
2996
  */
2765
2997
 
2766
- export { GANTT_GLOBAL_CONFIG, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttDate, GanttDatePoint, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLoadOnScrollEvent, GanttPrintService, GanttTableEvent, GanttUpper, GanttView, GanttViewType, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttRangeItemPipe, NgxGanttBarComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, defaultConfig, primaryDatePointTop, secondaryDatePointTop };
2998
+ export { GANTT_GLOBAL_CONFIG, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttDate, GanttDatePoint, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLinkLineType, GanttLinkType, GanttLoadOnScrollEvent, GanttPrintService, GanttSelectedEvent, GanttTableEvent, GanttUpper, GanttView, GanttViewType, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttRangeItemPipe, LinkColors, NgxGanttBarComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, defaultConfig, primaryDatePointTop, secondaryDatePointTop };
2767
2999
  //# sourceMappingURL=worktile-gantt.js.map