@worktile/gantt 12.2.0-next.1 → 12.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/bundles/worktile-gantt.umd.js +581 -508
  2. package/bundles/worktile-gantt.umd.js.map +1 -1
  3. package/class/event.d.ts +2 -0
  4. package/class/index.d.ts +1 -0
  5. package/class/item.d.ts +1 -1
  6. package/class/link.d.ts +12 -7
  7. package/components/bar/bar-drag.d.ts +4 -2
  8. package/components/bar/bar.component.d.ts +4 -4
  9. package/components/calendar/calendar.component.d.ts +3 -5
  10. package/components/drag-backdrop/drag-backdrop.component.d.ts +1 -5
  11. package/components/icon/icon.component.d.ts +2 -4
  12. package/components/links/{paths → lines}/curve.d.ts +2 -3
  13. package/components/links/lines/factory.d.ts +5 -0
  14. package/components/links/{paths/path.d.ts → lines/line.d.ts} +1 -4
  15. package/components/links/{paths/line.d.ts → lines/straight.d.ts} +2 -2
  16. package/components/links/links.component.d.ts +2 -2
  17. package/components/main/gantt-main.component.d.ts +2 -3
  18. package/components/range/range.component.d.ts +2 -5
  19. package/components/table/gantt-table.component.d.ts +2 -3
  20. package/esm2015/class/event.js +1 -1
  21. package/esm2015/class/index.js +2 -1
  22. package/esm2015/class/item.js +4 -3
  23. package/esm2015/class/link.js +6 -6
  24. package/esm2015/components/bar/bar-drag.js +56 -26
  25. package/esm2015/components/bar/bar.component.js +22 -15
  26. package/esm2015/components/calendar/calendar.component.js +18 -13
  27. package/esm2015/components/drag-backdrop/drag-backdrop.component.js +10 -14
  28. package/esm2015/components/icon/icon.component.js +4 -6
  29. package/esm2015/components/links/lines/curve.js +96 -0
  30. package/esm2015/components/links/lines/factory.js +14 -0
  31. package/esm2015/components/links/lines/line.js +24 -0
  32. package/esm2015/components/links/lines/straight.js +58 -0
  33. package/esm2015/components/links/links.component.js +31 -17
  34. package/esm2015/components/main/gantt-main.component.js +4 -5
  35. package/esm2015/components/range/range.component.js +4 -13
  36. package/esm2015/components/table/gantt-table.component.js +10 -6
  37. package/esm2015/gantt-dom.service.js +41 -27
  38. package/esm2015/gantt-drag-container.js +57 -40
  39. package/esm2015/gantt-item-upper.js +7 -7
  40. package/esm2015/gantt-print.service.js +53 -50
  41. package/esm2015/gantt-upper.js +37 -20
  42. package/esm2015/gantt.component.js +25 -28
  43. package/esm2015/gantt.config.js +3 -3
  44. package/esm2015/gantt.module.js +4 -4
  45. package/esm2015/gantt.pipe.js +9 -9
  46. package/esm2015/root.component.js +43 -31
  47. package/esm2015/table/gantt-column.component.js +4 -5
  48. package/esm2015/table/gantt-table.component.js +5 -6
  49. package/esm2015/utils/passive-listeners.js +30 -0
  50. package/esm2015/utils/set-style-with-vendor-prefix.js +15 -0
  51. package/esm2015/views/day.js +1 -1
  52. package/fesm2015/worktile-gantt.js +492 -386
  53. package/fesm2015/worktile-gantt.js.map +1 -1
  54. package/gantt-dom.service.d.ts +11 -4
  55. package/gantt-drag-container.d.ts +20 -8
  56. package/gantt-item-upper.d.ts +5 -5
  57. package/gantt-print.service.d.ts +1 -1
  58. package/gantt-upper.d.ts +10 -8
  59. package/gantt.component.d.ts +3 -7
  60. package/gantt.config.d.ts +2 -2
  61. package/main.bundle.scss +34 -3
  62. package/package.json +1 -1
  63. package/root.component.d.ts +5 -3
  64. package/table/gantt-column.component.d.ts +2 -3
  65. package/table/gantt-table.component.d.ts +2 -4
  66. package/utils/passive-listeners.d.ts +13 -0
  67. package/utils/set-style-with-vendor-prefix.d.ts +12 -0
  68. package/README.md +0 -24
  69. package/components/links/paths/factory.d.ts +0 -5
  70. package/esm2015/components/links/paths/curve.js +0 -118
  71. package/esm2015/components/links/paths/factory.js +0 -14
  72. package/esm2015/components/links/paths/line.js +0 -59
  73. package/esm2015/components/links/paths/path.js +0 -31
@@ -1,17 +1,16 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, EventEmitter, Directive, Inject, Input, Output, ContentChild, HostBinding, Component, Pipe, ViewChild, Injectable, Optional, forwardRef, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
2
+ import { InjectionToken, EventEmitter, Directive, Inject, Input, Output, ContentChild, HostBinding, Component, Pipe, ViewChild, PLATFORM_ID, Injectable, ElementRef, Optional, SkipSelf, ViewChildren, forwardRef, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
3
3
  import * as i2 from '@angular/common';
4
- import { CommonModule } from '@angular/common';
5
- import { take, skip, takeUntil, startWith, map, pairwise, auditTime, debounceTime, finalize } from 'rxjs/operators';
6
- import { BehaviorSubject, Subject, merge, fromEvent } from 'rxjs';
4
+ import { isPlatformServer, CommonModule } from '@angular/common';
5
+ import { take, takeUntil, skip, map, pairwise, auditTime, startWith, debounceTime, switchMap, finalize } from 'rxjs/operators';
6
+ import { BehaviorSubject, Subject, from, merge, fromEvent, Observable, EMPTY } 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
9
  import { SelectionModel } from '@angular/cdk/collections';
10
10
  import { coerceBooleanProperty, coerceCssPixelValue } from '@angular/cdk/coercion';
11
11
  import * as i1 from '@angular/cdk/drag-drop';
12
12
  import { DragDropModule } from '@angular/cdk/drag-drop';
13
- import html2canvas from 'html2canvas';
14
- import { __decorate, __param } from 'tslib';
13
+ import { __awaiter, __decorate, __param } from 'tslib';
15
14
 
16
15
  class GanttDatePoint {
17
16
  constructor(start, text, x, y, additions) {
@@ -212,11 +211,11 @@ var GanttLinkType;
212
211
  GanttLinkType[GanttLinkType["ss"] = 3] = "ss";
213
212
  GanttLinkType[GanttLinkType["sf"] = 4] = "sf";
214
213
  })(GanttLinkType || (GanttLinkType = {}));
215
- var GanttLinkPathType;
216
- (function (GanttLinkPathType) {
217
- GanttLinkPathType["curve"] = "curve";
218
- GanttLinkPathType["line"] = "line";
219
- })(GanttLinkPathType || (GanttLinkPathType = {}));
214
+ var GanttLinkLineType;
215
+ (function (GanttLinkLineType) {
216
+ GanttLinkLineType["curve"] = "curve";
217
+ GanttLinkLineType["straight"] = "straight";
218
+ })(GanttLinkLineType || (GanttLinkLineType = {}));
220
219
  var LinkColors;
221
220
  (function (LinkColors) {
222
221
  LinkColors["default"] = "#cacaca";
@@ -303,8 +302,9 @@ class GanttItemInternal {
303
302
  this.expanded = expanded;
304
303
  this.origin.expanded = expanded;
305
304
  }
306
- addLink(linkId) {
307
- this.links = [...this.links, { type: GanttLinkType.fs, link: linkId }];
305
+ addLink(link) {
306
+ console.log(link);
307
+ this.links = [...this.links, link];
308
308
  this.origin.links = this.links;
309
309
  }
310
310
  }
@@ -338,7 +338,7 @@ const defaultConfig = {
338
338
  linkOptions: {
339
339
  dependencyTypes: [GanttLinkType.fs],
340
340
  showArrow: false,
341
- linkPathType: GanttLinkPathType.curve
341
+ lineType: GanttLinkLineType.curve
342
342
  }
343
343
  };
344
344
  const GANTT_GLOBAL_CONFIG = new InjectionToken('GANTT_GLOBAL_CONFIG');
@@ -791,7 +791,9 @@ class GanttUpper {
791
791
  this.cdr = cdr;
792
792
  this.ngZone = ngZone;
793
793
  this.config = config;
794
+ // eslint-disable-next-line @angular-eslint/no-input-rename
794
795
  this.originItems = [];
796
+ // eslint-disable-next-line @angular-eslint/no-input-rename
795
797
  this.originGroups = [];
796
798
  this.viewType = GanttViewType.month;
797
799
  this.showTodayLine = true;
@@ -812,6 +814,12 @@ class GanttUpper {
812
814
  this._multiple = false;
813
815
  this.ganttClass = true;
814
816
  }
817
+ set linkOptions(options) {
818
+ this._linkOptions = options;
819
+ }
820
+ get linkOptions() {
821
+ return Object.assign({}, defaultConfig.linkOptions, this.config.linkOptions, this._linkOptions);
822
+ }
815
823
  set selectable(value) {
816
824
  var _a;
817
825
  this._selectable = coerceBooleanProperty(value);
@@ -934,7 +942,7 @@ class GanttUpper {
934
942
  initSelectionModel() {
935
943
  return new SelectionModel(this.multiple, []);
936
944
  }
937
- onInit() {
945
+ ngOnInit() {
938
946
  this.styles = Object.assign({}, defaultStyles, this.styles);
939
947
  this.viewOptions.dateFormat = Object.assign({}, defaultConfig.dateFormat, this.config.dateFormat, this.viewOptions.dateFormat);
940
948
  this.createView();
@@ -943,25 +951,32 @@ class GanttUpper {
943
951
  this.computeRefs();
944
952
  this.initSelectionModel();
945
953
  this.firstChange = false;
946
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
947
- this.element.style.opacity = '1';
948
- this.dragContainer.dragStarted.subscribe((event) => {
949
- this.dragStarted.emit(event);
950
- });
951
- this.dragContainer.dragMoved.subscribe((event) => {
952
- this.dragMoved.emit(event);
953
- });
954
- this.dragContainer.dragEnded.subscribe((event) => {
955
- this.dragEnded.emit(event);
956
- this.computeRefs();
957
- this.detectChanges();
954
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
955
+ // the `onStable` will never emit any value.
956
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
957
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
958
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
959
+ this.ngZone.runOutsideAngular(() => {
960
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
961
+ this.element.style.opacity = '1';
962
+ this.dragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
963
+ this.dragStarted.emit(event);
964
+ });
965
+ this.dragContainer.dragMoved.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
966
+ this.dragMoved.emit(event);
967
+ });
968
+ this.dragContainer.dragEnded.pipe(takeUntil(this.unsubscribe$)).subscribe((event) => {
969
+ this.dragEnded.emit(event);
970
+ this.computeRefs();
971
+ this.detectChanges();
972
+ });
958
973
  });
959
974
  });
960
975
  this.view.start$.pipe(skip(1), takeUntil(this.unsubscribe$)).subscribe(() => {
961
976
  this.computeRefs();
962
977
  });
963
978
  }
964
- onChanges(changes) {
979
+ ngOnChanges(changes) {
965
980
  if (!this.firstChange) {
966
981
  if (changes.viewType && changes.viewType.currentValue) {
967
982
  this.createView();
@@ -978,7 +993,7 @@ class GanttUpper {
978
993
  }
979
994
  }
980
995
  }
981
- onDestroy() {
996
+ ngOnDestroy() {
982
997
  this.unsubscribe$.next();
983
998
  this.unsubscribe$.complete();
984
999
  }
@@ -1032,9 +1047,9 @@ class GanttUpper {
1032
1047
  return this.selectionModel.isSelected(id);
1033
1048
  }
1034
1049
  }
1035
- 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 });
1036
- 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", 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 });
1037
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttUpper, decorators: [{
1050
+ 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 });
1051
+ 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 }], usesOnChanges: true, ngImport: i0 });
1052
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttUpper, decorators: [{
1038
1053
  type: Directive
1039
1054
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
1040
1055
  type: Inject,
@@ -1059,6 +1074,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1059
1074
  type: Input
1060
1075
  }], viewOptions: [{
1061
1076
  type: Input
1077
+ }], linkOptions: [{
1078
+ type: Input
1062
1079
  }], disabledLoadOnScroll: [{
1063
1080
  type: Input
1064
1081
  }], selectable: [{
@@ -1103,11 +1120,10 @@ class NgxGanttTableColumnComponent {
1103
1120
  set width(width) {
1104
1121
  this.columnWidth = coerceCssPixelValue(width);
1105
1122
  }
1106
- ngOnInit() { }
1107
1123
  }
1108
- 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 });
1109
- 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 });
1110
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
1124
+ 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 });
1125
+ 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 });
1126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttTableColumnComponent, decorators: [{
1111
1127
  type: Component,
1112
1128
  args: [{
1113
1129
  selector: 'ngx-gantt-column',
@@ -1132,17 +1148,16 @@ class NgxGanttTableComponent {
1132
1148
  constructor() {
1133
1149
  this.columnChanges = new EventEmitter();
1134
1150
  }
1135
- ngOnInit() { }
1136
1151
  }
1137
- NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1138
- 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 });
1139
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttTableComponent, decorators: [{
1152
+ NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1153
+ 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 });
1154
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttTableComponent, decorators: [{
1140
1155
  type: Component,
1141
1156
  args: [{
1142
1157
  selector: 'ngx-gantt-table',
1143
1158
  template: ''
1144
1159
  }]
1145
- }], ctorParameters: function () { return []; }, propDecorators: { columnChanges: [{
1160
+ }], propDecorators: { columnChanges: [{
1146
1161
  type: Output
1147
1162
  }], rowBeforeTemplate: [{
1148
1163
  type: ContentChild,
@@ -1154,6 +1169,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1154
1169
 
1155
1170
  const GANTT_ABSTRACT_TOKEN = new InjectionToken('gantt-abstract-token');
1156
1171
 
1172
+ const supports = (typeof window !== 'undefined' && !!window.CSS && CSS.supports) || (() => false);
1173
+ /**
1174
+ * Note: we don't need to add vendor prefixes within `.scss` files since they're added automatically.
1175
+ * This function is necessary when the `element.style` is updated directly through the JavaScript.
1176
+ * This is not required to be used with CSS properties that don't require vendor prefixes (e.g. `opacity`).
1177
+ */
1178
+ function setStyleWithVendorPrefix({ element, style, value }) {
1179
+ element.style[style] = value;
1180
+ if (supports(`-webkit-${style}: ${value}`)) {
1181
+ // Note: some browsers still require setting `-webkit` vendor prefix. E.g. Mozilla 49 has implemented
1182
+ // the 3D support for `transform`, but it requires setting `-webkit-` prefix.
1183
+ element.style[`-webkit-${style}`] = value;
1184
+ }
1185
+ }
1186
+
1157
1187
  const angleRight = `<svg xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="amnavigation/angle-right" stroke-width="1" fill-rule="evenodd"><path d="M7.978 11.498l-.005.005L2.3 5.831 3.13 5l4.848 4.848L12.826 5l.83.831-5.673 5.672-.005-.005z" transform="rotate(-90 7.978 8.252)"></path></g></svg>`;
1158
1188
  const angleDown = `<svg xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="aknavigation/angle-down" stroke-width="1" fill-rule="evenodd"><path d="M7.978 11.997l-.005.006L2.3 6.33l.83-.831 4.848 4.848L12.826 5.5l.83.83-5.673 5.673-.005-.006z" ></path></g></svg>`;
1159
1189
  const plusSquare = `<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="kxaction/plus-square" stroke-width="1" fill-rule="evenodd"><path d="M2 0h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2zm0 1.2a.8.8 0 0 0-.8.8v12a.8.8 0 0 0 .8.8h12a.8.8 0 0 0 .8-.8V2a.8.8 0 0 0-.8-.8H2zm5.45 6.2V4.75h1.2V7.4h2.65v1.2H8.65v2.65h-1.2V8.6H4.8V7.4h2.65z"></path></g></svg>`;
@@ -1249,8 +1279,6 @@ class GanttIconComponent {
1249
1279
  set iconName(name) {
1250
1280
  this.setSvg(name);
1251
1281
  }
1252
- ngOnInit() { }
1253
- ngAfterViewInit() { }
1254
1282
  setSvg(name) {
1255
1283
  const iconSvg = icons[name];
1256
1284
  if (iconSvg) {
@@ -1261,9 +1289,9 @@ class GanttIconComponent {
1261
1289
  }
1262
1290
  }
1263
1291
  }
1264
- GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1265
- 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 });
1266
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttIconComponent, decorators: [{
1292
+ GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1293
+ 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 });
1294
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttIconComponent, decorators: [{
1267
1295
  type: Component,
1268
1296
  args: [{
1269
1297
  selector: 'gantt-icon',
@@ -1281,9 +1309,9 @@ class IsGanttRangeItemPipe {
1281
1309
  return value === GanttItemType.range;
1282
1310
  }
1283
1311
  }
1284
- IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1285
- IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1286
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
1312
+ IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1313
+ IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1314
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
1287
1315
  type: Pipe,
1288
1316
  args: [{
1289
1317
  name: 'isGanttRangeItem'
@@ -1294,9 +1322,9 @@ class IsGanttBarItemPipe {
1294
1322
  return value === GanttItemType.bar;
1295
1323
  }
1296
1324
  }
1297
- IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1298
- IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1299
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
1325
+ IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1326
+ IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1327
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
1300
1328
  type: Pipe,
1301
1329
  args: [{
1302
1330
  name: 'isGanttBarItem'
@@ -1307,9 +1335,9 @@ class IsGanttCustomItemPipe {
1307
1335
  return value === GanttItemType.custom;
1308
1336
  }
1309
1337
  }
1310
- IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1311
- IsGanttCustomItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1312
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
1338
+ IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1339
+ IsGanttCustomItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1340
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
1313
1341
  type: Pipe,
1314
1342
  args: [{
1315
1343
  name: 'isGanttCustomItem'
@@ -1335,7 +1363,6 @@ class GanttTableComponent {
1335
1363
  });
1336
1364
  this.columnList = columns;
1337
1365
  }
1338
- ngOnInit() { }
1339
1366
  ngOnChanges(changes) {
1340
1367
  var _a, _b;
1341
1368
  if (!((_a = changes.groups.currentValue) === null || _a === void 0 ? void 0 : _a.length) && !((_b = changes.items.currentValue) === null || _b === void 0 ? void 0 : _b.length)) {
@@ -1347,7 +1374,11 @@ class GanttTableComponent {
1347
1374
  }
1348
1375
  dragFixed(config) {
1349
1376
  if (config.movedWidth < config.minWidth) {
1350
- config.target.style.transform = `translate3d(${config.minWidth - config.originWidth}px, 0, 0)`;
1377
+ setStyleWithVendorPrefix({
1378
+ element: config.target,
1379
+ style: 'transform',
1380
+ value: `translate3d(${config.minWidth - config.originWidth}px, 0, 0)`
1381
+ });
1351
1382
  }
1352
1383
  }
1353
1384
  expandGroup(group) {
@@ -1428,9 +1459,9 @@ class GanttTableComponent {
1428
1459
  return item.id || index;
1429
1460
  }
1430
1461
  }
1431
- GanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttTableComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }, { token: GANTT_UPPER_TOKEN }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1432
- 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" }, 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 } });
1433
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttTableComponent, decorators: [{
1462
+ 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 });
1463
+ 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 } });
1464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttTableComponent, decorators: [{
1434
1465
  type: Component,
1435
1466
  args: [{
1436
1467
  selector: 'gantt-table',
@@ -1469,6 +1500,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1469
1500
  args: ['class.gantt-table-empty']
1470
1501
  }] } });
1471
1502
 
1503
+ /** Cached result of whether the user's browser supports passive event listeners. */
1504
+ let supportsPassiveEvents;
1505
+ /**
1506
+ * Checks whether the user's browser supports passive event listeners.
1507
+ * See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
1508
+ */
1509
+ function supportsPassiveEventListeners() {
1510
+ if (supportsPassiveEvents == null && typeof window !== 'undefined') {
1511
+ try {
1512
+ window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
1513
+ get: () => (supportsPassiveEvents = true)
1514
+ }));
1515
+ }
1516
+ finally {
1517
+ supportsPassiveEvents = supportsPassiveEvents || false;
1518
+ }
1519
+ }
1520
+ return supportsPassiveEvents;
1521
+ }
1522
+ /**
1523
+ * Normalizes an `AddEventListener` object to something that can be passed
1524
+ * to `addEventListener` on any browser, no matter whether it supports the
1525
+ * `options` parameter.
1526
+ */
1527
+ function normalizePassiveListenerOptions(options) {
1528
+ return supportsPassiveEventListeners() ? options : !!options.capture;
1529
+ }
1530
+ /** Options used to bind passive event listeners. */
1531
+ const passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
1532
+
1472
1533
  const scrollThreshold = 50;
1473
1534
  var ScrollDirection;
1474
1535
  (function (ScrollDirection) {
@@ -1477,24 +1538,26 @@ var ScrollDirection;
1477
1538
  ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1478
1539
  })(ScrollDirection || (ScrollDirection = {}));
1479
1540
  class GanttDomService {
1480
- constructor() {
1541
+ constructor(ngZone, platformId) {
1542
+ this.ngZone = ngZone;
1543
+ this.platformId = platformId;
1481
1544
  this.unsubscribe$ = new Subject();
1482
1545
  }
1483
1546
  monitorScrollChange() {
1484
- merge(fromEvent(this.mainContainer, 'scroll'), fromEvent(this.sideContainer, 'scroll'))
1547
+ this.ngZone.runOutsideAngular(() => merge(fromEvent(this.mainContainer, 'scroll', passiveListenerOptions), fromEvent(this.sideContainer, 'scroll', passiveListenerOptions))
1485
1548
  .pipe(takeUntil(this.unsubscribe$))
1486
1549
  .subscribe((event) => {
1487
1550
  this.syncScroll(event);
1488
- });
1489
- fromEvent(this.mainContainer, 'scroll')
1490
- .pipe(startWith(), takeUntil(this.unsubscribe$))
1491
- .subscribe((event) => {
1492
- // if (this.mainContainer.scrollLeft > 0) {
1493
- // this.side.classList.add('gantt-side-has-shadow');
1494
- // } else {
1495
- // this.side.classList.remove('gantt-side-has-shadow');
1496
- // }
1497
- });
1551
+ }));
1552
+ // fromEvent(this.mainContainer, 'scroll')
1553
+ // .pipe(startWith(), takeUntil(this.unsubscribe$))
1554
+ // .subscribe((event) => {
1555
+ // // if (this.mainContainer.scrollLeft > 0) {
1556
+ // // this.side.classList.add('gantt-side-has-shadow');
1557
+ // // } else {
1558
+ // // this.side.classList.remove('gantt-side-has-shadow');
1559
+ // // }
1560
+ // });
1498
1561
  }
1499
1562
  syncScroll(event) {
1500
1563
  const target = event.currentTarget;
@@ -1504,7 +1567,7 @@ class GanttDomService {
1504
1567
  }
1505
1568
  disableBrowserWheelEvent() {
1506
1569
  const container = this.mainContainer;
1507
- fromEvent(container, 'wheel')
1570
+ this.ngZone.runOutsideAngular(() => fromEvent(container, 'wheel')
1508
1571
  .pipe(takeUntil(this.unsubscribe$))
1509
1572
  .subscribe((event) => {
1510
1573
  const delta = event.deltaX;
@@ -1515,7 +1578,7 @@ class GanttDomService {
1515
1578
  (container.scrollLeft === 0 && delta < 0)) {
1516
1579
  event.preventDefault();
1517
1580
  }
1518
- });
1581
+ }));
1519
1582
  }
1520
1583
  initialize(root) {
1521
1584
  this.root = root.nativeElement;
@@ -1527,8 +1590,13 @@ class GanttDomService {
1527
1590
  this.monitorScrollChange();
1528
1591
  this.disableBrowserWheelEvent();
1529
1592
  }
1530
- getViewerScroll() {
1531
- return fromEvent(this.mainContainer, 'scroll').pipe(map(() => this.mainContainer.scrollLeft), pairwise(), map(([previous, current]) => {
1593
+ /**
1594
+ * @returns An observable that will emit outside the Angular zone. Note, consumers should re-enter the Angular zone
1595
+ * to run the change detection if needed.
1596
+ */
1597
+ getViewerScroll(options) {
1598
+ return new Observable((subscriber) => this.ngZone.runOutsideAngular(() => fromEvent(this.mainContainer, 'scroll', options)
1599
+ .pipe(map(() => this.mainContainer.scrollLeft), pairwise(), map(([previous, current]) => {
1532
1600
  const event = {
1533
1601
  target: this.mainContainer,
1534
1602
  direction: ScrollDirection.NONE
@@ -1539,15 +1607,17 @@ class GanttDomService {
1539
1607
  }
1540
1608
  }
1541
1609
  if (current - previous > 0) {
1542
- if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft < scrollThreshold) {
1610
+ if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft <
1611
+ scrollThreshold) {
1543
1612
  event.direction = ScrollDirection.RIGHT;
1544
1613
  }
1545
1614
  }
1546
1615
  return event;
1547
- }));
1616
+ }))
1617
+ .subscribe(subscriber)));
1548
1618
  }
1549
1619
  getResize() {
1550
- return fromEvent(window, 'resize').pipe(auditTime(150));
1620
+ return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
1551
1621
  }
1552
1622
  scrollMainContainer(left) {
1553
1623
  if (isNumber(left)) {
@@ -1561,69 +1631,101 @@ class GanttDomService {
1561
1631
  this.unsubscribe$.complete();
1562
1632
  }
1563
1633
  }
1564
- GanttDomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1565
- GanttDomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService });
1566
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService, decorators: [{
1634
+ GanttDomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDomService, deps: [{ token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
1635
+ GanttDomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDomService });
1636
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDomService, decorators: [{
1567
1637
  type: Injectable
1568
- }], ctorParameters: function () { return []; } });
1638
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: undefined, decorators: [{
1639
+ type: Inject,
1640
+ args: [PLATFORM_ID]
1641
+ }] }]; } });
1569
1642
 
1643
+ function getDependencyType(path, dependencyTypes) {
1644
+ if (dependencyTypes.includes(GanttLinkType.ss) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.start) {
1645
+ return GanttLinkType.ss;
1646
+ }
1647
+ if (dependencyTypes.includes(GanttLinkType.ff) && path.from.pos === InBarPosition.finish && path.to.pos === InBarPosition.finish) {
1648
+ return GanttLinkType.ff;
1649
+ }
1650
+ if (dependencyTypes.includes(GanttLinkType.sf) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.finish) {
1651
+ return GanttLinkType.sf;
1652
+ }
1653
+ return GanttLinkType.fs;
1654
+ }
1655
+ var InBarPosition;
1656
+ (function (InBarPosition) {
1657
+ InBarPosition["start"] = "start";
1658
+ InBarPosition["finish"] = "finish";
1659
+ })(InBarPosition || (InBarPosition = {}));
1570
1660
  class GanttDragContainer {
1571
- constructor() {
1661
+ constructor(ganttUpper) {
1662
+ this.ganttUpper = ganttUpper;
1572
1663
  this.dragStarted = new EventEmitter();
1573
1664
  this.dragMoved = new EventEmitter();
1574
1665
  this.dragEnded = new EventEmitter();
1575
1666
  this.linkDragStarted = new EventEmitter();
1576
1667
  this.linkDragEntered = new EventEmitter();
1577
1668
  this.linkDragEnded = new EventEmitter();
1669
+ this.linkDragPath = { from: null, to: null };
1578
1670
  }
1579
- emitLinkDragStarted(from, item) {
1580
- this.linkDraggingId = item.id;
1581
- this.linkDragFrom = from;
1582
- this.linkDragSource = this.linkDragFrom === 'source' ? item : null;
1583
- this.linkDragTarget = this.linkDragFrom === 'target' ? item : null;
1671
+ emitLinkDragStarted(from) {
1672
+ this.linkDraggingId = from.item.id;
1673
+ this.linkDragPath.from = from;
1584
1674
  this.linkDragStarted.emit({
1585
- source: this.linkDragSource && this.linkDragSource.origin,
1586
- target: this.linkDragTarget && this.linkDragTarget.origin
1675
+ source: from.item.origin,
1676
+ target: null
1587
1677
  });
1588
1678
  }
1589
- emitLinkDragEntered(item) {
1590
- if (this.linkDragFrom === 'source') {
1591
- this.linkDragTarget = item;
1592
- }
1593
- else {
1594
- this.linkDragSource = item;
1595
- }
1679
+ emitLinkDragEntered(to) {
1680
+ this.linkDragPath.to = to;
1596
1681
  this.linkDragEntered.emit({
1597
- source: this.linkDragSource.origin,
1598
- target: this.linkDragTarget.origin
1682
+ source: this.linkDragPath.from.item.origin,
1683
+ target: to.item.origin
1599
1684
  });
1600
1685
  }
1601
1686
  emitLinkDragLeaved() {
1602
- if (this.linkDragFrom === 'source') {
1603
- this.linkDragTarget = null;
1604
- }
1605
- else {
1606
- this.linkDragSource = null;
1607
- }
1687
+ this.linkDragPath.to = null;
1608
1688
  }
1609
- emitLinkDragEnded() {
1689
+ emitLinkDragEnded(to) {
1690
+ var _a;
1691
+ this.linkDragPath.to = to;
1692
+ const dependencyType = getDependencyType(this.linkDragPath, (_a = this.ganttUpper.linkOptions) === null || _a === void 0 ? void 0 : _a.dependencyTypes);
1693
+ this.linkDragPath.from.item.addLink({
1694
+ link: this.linkDragPath.to.item.id,
1695
+ type: dependencyType
1696
+ });
1697
+ this.linkDragEnded.emit({
1698
+ source: this.linkDragPath.from.item.origin,
1699
+ target: this.linkDragPath.to.item.origin,
1700
+ type: dependencyType
1701
+ });
1610
1702
  this.linkDraggingId = null;
1611
- if (this.linkDragSource && this.linkDragTarget) {
1612
- this.linkDragSource.addLink(this.linkDragTarget.id);
1613
- this.linkDragEnded.emit({
1614
- source: this.linkDragSource.origin,
1615
- target: this.linkDragTarget.origin
1616
- });
1617
- }
1618
- this.linkDragSource = null;
1619
- this.linkDragTarget = null;
1703
+ this.linkDragPath = { from: null, to: null };
1620
1704
  }
1621
1705
  }
1622
- GanttDragContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1623
- GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer });
1624
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer, decorators: [{
1706
+ 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 });
1707
+ GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDragContainer });
1708
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDragContainer, decorators: [{
1625
1709
  type: Injectable
1626
- }], ctorParameters: function () { return []; } });
1710
+ }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
1711
+ type: Inject,
1712
+ args: [GANTT_UPPER_TOKEN]
1713
+ }] }]; } });
1714
+
1715
+ class GanttDragBackdropComponent {
1716
+ }
1717
+ GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1718
+ GanttDragBackdropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop", host: { classAttribute: "gantt-drag-backdrop" }, 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" });
1719
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
1720
+ type: Component,
1721
+ args: [{
1722
+ selector: 'gantt-drag-backdrop',
1723
+ templateUrl: `./drag-backdrop.component.html`,
1724
+ host: {
1725
+ class: 'gantt-drag-backdrop'
1726
+ }
1727
+ }]
1728
+ }] });
1627
1729
 
1628
1730
  class GanttPrintService {
1629
1731
  constructor() { }
@@ -1661,58 +1763,61 @@ class GanttPrintService {
1661
1763
  this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1662
1764
  }
1663
1765
  print(name = 'download', ignoreElementClass) {
1664
- const root = this.root;
1665
- const mainContainer = this.mainContainer;
1666
- // set print width
1667
- const printWidth = root.offsetWidth;
1668
- // set print height
1669
- const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
1670
- html2canvas(root, {
1671
- logging: false,
1672
- allowTaint: true,
1673
- useCORS: true,
1674
- width: printWidth,
1675
- height: printHeight,
1676
- ignoreElements: (element) => {
1677
- if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
1678
- return true;
1679
- }
1680
- if (element.classList.contains('gantt-calendar-today-overlay')) {
1681
- return true;
1682
- }
1683
- },
1684
- onclone: (cloneDocument) => {
1685
- const ganttClass = root.className;
1686
- const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
1687
- const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
1688
- const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
1689
- const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
1690
- // change targetDom width
1691
- cloneGanttDom.style.width = `${printWidth}px`;
1692
- cloneGanttDom.style.height = `${printHeight}px`;
1693
- cloneGanttDom.style.overflow = `unset`;
1694
- cloneGanttContainerDom.style.backgroundColor = '#fff';
1695
- cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
1696
- cloneCalendarOverlay.setAttribute('style', `background: transparent`);
1697
- if (cloneLinksOverlay) {
1698
- cloneLinksOverlay.setAttribute('height', `${printHeight}`);
1699
- cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
1766
+ return __awaiter(this, void 0, void 0, function* () {
1767
+ const root = this.root;
1768
+ const mainContainer = this.mainContainer;
1769
+ // set print width
1770
+ const printWidth = root.offsetWidth;
1771
+ // set print height
1772
+ const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
1773
+ const html2canvas = (yield import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')).default;
1774
+ html2canvas(root, {
1775
+ logging: false,
1776
+ allowTaint: true,
1777
+ useCORS: true,
1778
+ width: printWidth,
1779
+ height: printHeight,
1780
+ ignoreElements: (element) => {
1781
+ if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
1782
+ return true;
1783
+ }
1784
+ if (element.classList.contains('gantt-calendar-today-overlay')) {
1785
+ return true;
1786
+ }
1787
+ },
1788
+ onclone: (cloneDocument) => {
1789
+ const ganttClass = root.className;
1790
+ const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
1791
+ const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
1792
+ const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
1793
+ const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
1794
+ // change targetDom width
1795
+ cloneGanttDom.style.width = `${printWidth}px`;
1796
+ cloneGanttDom.style.height = `${printHeight}px`;
1797
+ cloneGanttDom.style.overflow = `unset`;
1798
+ cloneGanttContainerDom.style.backgroundColor = '#fff';
1799
+ cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
1800
+ cloneCalendarOverlay.setAttribute('style', `background: transparent`);
1801
+ if (cloneLinksOverlay) {
1802
+ cloneLinksOverlay.setAttribute('height', `${printHeight}`);
1803
+ cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
1804
+ }
1805
+ // setInlineStyles for svg
1806
+ this.setInlineStyles(cloneGanttDom);
1700
1807
  }
1701
- // setInlineStyles for svg
1702
- this.setInlineStyles(cloneGanttDom);
1703
- }
1704
- }).then((canvas) => {
1705
- const link = document.createElement('a');
1706
- const dataUrl = canvas.toDataURL('image/png');
1707
- link.download = `${name}.png`;
1708
- link.href = dataUrl;
1709
- link.click();
1808
+ }).then((canvas) => {
1809
+ const link = document.createElement('a');
1810
+ const dataUrl = canvas.toDataURL('image/png');
1811
+ link.download = `${name}.png`;
1812
+ link.href = dataUrl;
1813
+ link.click();
1814
+ });
1710
1815
  });
1711
1816
  }
1712
1817
  }
1713
- GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1714
- GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService });
1715
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService, decorators: [{
1818
+ GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1819
+ GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttPrintService });
1820
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttPrintService, decorators: [{
1716
1821
  type: Injectable
1717
1822
  }], ctorParameters: function () { return []; } });
1718
1823
 
@@ -1722,7 +1827,6 @@ class GanttCalendarComponent {
1722
1827
  this.ganttUpper = ganttUpper;
1723
1828
  this.ngZone = ngZone;
1724
1829
  this.elementRef = elementRef;
1725
- this.unsubscribe$ = new Subject();
1726
1830
  this.headerHeight = headerHeight;
1727
1831
  this.mainHeight = mainHeight;
1728
1832
  this.todayHeight = todayHeight;
@@ -1730,6 +1834,7 @@ class GanttCalendarComponent {
1730
1834
  this.todayBorderRadius = todayBorderRadius;
1731
1835
  this.viewTypes = GanttViewType;
1732
1836
  this.className = true;
1837
+ this.unsubscribe$ = new Subject();
1733
1838
  }
1734
1839
  get view() {
1735
1840
  return this.ganttUpper.view;
@@ -1757,16 +1862,21 @@ class GanttCalendarComponent {
1757
1862
  }
1758
1863
  }
1759
1864
  ngOnInit() {
1760
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
1761
- merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
1762
- .pipe(takeUntil(this.unsubscribe$))
1763
- .subscribe(() => {
1764
- this.setTodayPoint();
1865
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
1866
+ // the `onStable` will never emit any value.
1867
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
1868
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
1869
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
1870
+ this.ngZone.runOutsideAngular(() => {
1871
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1872
+ merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
1873
+ .pipe(takeUntil(this.unsubscribe$))
1874
+ .subscribe(() => {
1875
+ this.setTodayPoint();
1876
+ });
1765
1877
  });
1766
1878
  });
1767
1879
  }
1768
- ngAfterViewInit() { }
1769
- ngOnChanges(changes) { }
1770
1880
  trackBy(index, point) {
1771
1881
  return point.text || index;
1772
1882
  }
@@ -1775,9 +1885,9 @@ class GanttCalendarComponent {
1775
1885
  this.unsubscribe$.complete();
1776
1886
  }
1777
1887
  }
1778
- 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 });
1779
- 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"] }] });
1780
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttCalendarComponent, decorators: [{
1888
+ 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 });
1889
+ 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" } }, 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"] }] });
1890
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttCalendarComponent, decorators: [{
1781
1891
  type: Component,
1782
1892
  args: [{
1783
1893
  selector: 'gantt-calendar-overlay',
@@ -1791,25 +1901,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1791
1901
  args: ['class.gantt-calendar-overlay']
1792
1902
  }] } });
1793
1903
 
1794
- class GanttDragBackdropComponent {
1795
- constructor() {
1796
- this.backdropClass = true;
1797
- }
1798
- ngOnInit() { }
1799
- }
1800
- GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1801
- 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" });
1802
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
1803
- type: Component,
1804
- args: [{
1805
- selector: 'gantt-drag-backdrop',
1806
- templateUrl: `./drag-backdrop.component.html`
1807
- }]
1808
- }], ctorParameters: function () { return []; }, propDecorators: { backdropClass: [{
1809
- type: HostBinding,
1810
- args: ['class.gantt-drag-backdrop']
1811
- }] } });
1812
-
1813
1904
  class NgxGanttRootComponent {
1814
1905
  constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
1815
1906
  this.elementRef = elementRef;
@@ -1818,7 +1909,6 @@ class NgxGanttRootComponent {
1818
1909
  this.dragContainer = dragContainer;
1819
1910
  this.ganttUpper = ganttUpper;
1820
1911
  this.printService = printService;
1821
- this.ganttClass = true;
1822
1912
  this.unsubscribe$ = new Subject();
1823
1913
  this.ganttUpper.dragContainer = dragContainer;
1824
1914
  }
@@ -1826,44 +1916,52 @@ class NgxGanttRootComponent {
1826
1916
  return this.ganttUpper.view;
1827
1917
  }
1828
1918
  ngOnInit() {
1829
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
1830
- this.dom.initialize(this.elementRef);
1831
- if (this.printService) {
1832
- this.printService.register(this.elementRef);
1833
- }
1834
- this.setupScrollClass();
1835
- this.setupResize();
1836
- this.setupViewScroll();
1837
- // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
1838
- this.elementRef.nativeElement.style.opacity = '1';
1839
- this.ganttUpper.viewChange.pipe(startWith(null)).subscribe(() => {
1840
- this.scrollToToday();
1919
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
1920
+ // the `onStable` will never emit any value.
1921
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
1922
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
1923
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
1924
+ this.ngZone.runOutsideAngular(() => {
1925
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1926
+ this.dom.initialize(this.elementRef);
1927
+ if (this.printService) {
1928
+ this.printService.register(this.elementRef);
1929
+ }
1930
+ this.setupScrollClass();
1931
+ this.setupResize();
1932
+ this.setupViewScroll();
1933
+ // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
1934
+ this.elementRef.nativeElement.style.opacity = '1';
1935
+ this.ganttUpper.viewChange.pipe(startWith(null), takeUntil(this.unsubscribe$)).subscribe(() => {
1936
+ this.scrollToToday();
1937
+ });
1841
1938
  });
1842
1939
  });
1843
1940
  }
1941
+ ngOnDestroy() {
1942
+ this.unsubscribe$.next();
1943
+ }
1844
1944
  setupViewScroll() {
1845
1945
  if (this.ganttUpper.disabledLoadOnScroll) {
1846
1946
  return;
1847
1947
  }
1848
1948
  this.dom
1849
- .getViewerScroll()
1949
+ .getViewerScroll(passiveListenerOptions)
1850
1950
  .pipe(takeUntil(this.unsubscribe$))
1851
1951
  .subscribe((event) => {
1852
1952
  if (event.direction === ScrollDirection.LEFT) {
1853
1953
  const dates = this.view.addStartDate();
1854
1954
  if (dates) {
1855
1955
  event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
1856
- this.ngZone.run(() => {
1857
- this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() });
1858
- });
1956
+ if (this.ganttUpper.loadOnScroll.observers) {
1957
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
1958
+ }
1859
1959
  }
1860
1960
  }
1861
1961
  if (event.direction === ScrollDirection.RIGHT) {
1862
1962
  const dates = this.view.addEndDate();
1863
- if (dates) {
1864
- this.ngZone.run(() => {
1865
- this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() });
1866
- });
1963
+ if (dates && this.ganttUpper.loadOnScroll.observers) {
1964
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
1867
1965
  }
1868
1966
  }
1869
1967
  });
@@ -1892,14 +1990,17 @@ class NgxGanttRootComponent {
1892
1990
  this.dom.scrollMainContainer(x);
1893
1991
  }
1894
1992
  }
1895
- 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 });
1896
- 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"] }] });
1897
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
1993
+ 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 });
1994
+ NgxGanttRootComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: { sideWidth: "sideWidth" }, host: { classAttribute: "gantt" }, providers: [GanttDomService, GanttDragContainer], queries: [{ propertyName: "sideTemplate", first: true, predicate: ["sideTemplate"], descendants: true, static: true }, { propertyName: "mainTemplate", first: true, predicate: ["mainTemplate"], descendants: true, static: true }], viewQueries: [{ propertyName: "backdrop", first: true, predicate: GanttDragBackdropComponent, descendants: true, read: ElementRef, 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"] }] });
1995
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
1898
1996
  type: Component,
1899
1997
  args: [{
1900
1998
  selector: 'ngx-gantt-root',
1901
1999
  templateUrl: './root.component.html',
1902
- providers: [GanttDomService, GanttDragContainer]
2000
+ providers: [GanttDomService, GanttDragContainer],
2001
+ host: {
2002
+ class: 'gantt'
2003
+ }
1903
2004
  }]
1904
2005
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
1905
2006
  type: Inject,
@@ -1908,18 +2009,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1908
2009
  type: Optional
1909
2010
  }] }]; }, propDecorators: { sideWidth: [{
1910
2011
  type: Input
1911
- }], ganttClass: [{
1912
- type: HostBinding,
1913
- args: ['class.gantt']
1914
2012
  }], sideTemplate: [{
1915
2013
  type: ContentChild,
1916
2014
  args: ['sideTemplate', { static: true }]
1917
2015
  }], mainTemplate: [{
1918
2016
  type: ContentChild,
1919
2017
  args: ['mainTemplate', { static: true }]
2018
+ }], backdrop: [{
2019
+ type: ViewChild,
2020
+ args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
1920
2021
  }] } });
1921
2022
 
1922
- class GanttLinkPath {
2023
+ class GanttLinkLine {
1923
2024
  constructor() { }
1924
2025
  generatePath(source, target, type) {
1925
2026
  if (source.before && source.after && target.before && target.after) {
@@ -1941,17 +2042,11 @@ class GanttLinkPath {
1941
2042
  }
1942
2043
  }
1943
2044
  }
1944
- GanttLinkPath.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttLinkPath, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1945
- GanttLinkPath.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttLinkPath });
1946
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttLinkPath, decorators: [{
1947
- type: Injectable
1948
- }], ctorParameters: function () { return []; } });
1949
2045
 
1950
- let GanttLinkPathCurve = class GanttLinkPathCurve extends GanttLinkPath {
2046
+ let GanttLinkLineCurve = class GanttLinkLineCurve extends GanttLinkLine {
1951
2047
  constructor(ganttUpper) {
1952
2048
  super();
1953
2049
  this.ganttUpper = ganttUpper;
1954
- this.bezierWeight = -0.5;
1955
2050
  }
1956
2051
  generateSSPath(source, target) {
1957
2052
  const x1 = source.before.x;
@@ -1990,76 +2085,55 @@ let GanttLinkPathCurve = class GanttLinkPathCurve extends GanttLinkPath {
1990
2085
  }
1991
2086
  }
1992
2087
  generateFSAndSFPath(source, target, type) {
2088
+ var _a;
1993
2089
  let x1 = source.after.x;
1994
2090
  let y1 = source.after.y;
1995
2091
  let x4 = target.before.x;
1996
2092
  let y4 = target.before.y;
2093
+ const bezierWeight = 0.5;
1997
2094
  if (type === GanttLinkType.sf) {
1998
2095
  x1 = target.after.x;
1999
2096
  y1 = target.after.y;
2000
2097
  x4 = source.before.x;
2001
2098
  y4 = source.before.y;
2002
2099
  }
2003
- const dx = Math.abs(x4 - x1) * this.bezierWeight;
2004
- const x2 = x1 - dx;
2005
- const x3 = x4 + dx;
2100
+ let dx = Math.abs(x4 - x1) * bezierWeight;
2101
+ let x2 = x1 + dx;
2102
+ let x3 = x4 - dx;
2006
2103
  const centerX = (x1 + x4) / 2;
2007
2104
  const centerY = (y1 + y4) / 2;
2008
2105
  let controlX = this.ganttUpper.styles.lineHeight / 2;
2009
2106
  const controlY = this.ganttUpper.styles.lineHeight / 2;
2010
2107
  if (x1 >= x4) {
2011
- if (y4 > y1) {
2012
- if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
2013
- return `M ${x1} ${y1}
2014
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 + controlX} ${x1} ${y1 + controlY}
2015
- L ${x4} ${y4 - controlY}
2016
- C ${x4 - controlY} ${y4 - controlY} ${x4 - controlX} ${y4} ${x4} ${y4}`;
2017
- }
2018
- else {
2019
- controlX = this.ganttUpper.styles.lineHeight;
2020
- return `M ${x1} ${y1}
2021
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 + controlX} ${centerX} ${centerY}
2022
- C ${x4 - controlX} ${y4 - controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
2108
+ if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
2109
+ return `M ${x1} ${y1}
2110
+ C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${x1} ${y4 > y1 ? y1 + controlY : y1 - controlY}
2111
+ L ${x4} ${y4 > y1 ? y4 - controlY : y4 + controlY}
2112
+ C ${x4 - controlY} ${y4 > y1 ? y4 - controlY : y4 + controlY} ${x4 - controlX} ${y4} ${x4} ${y4}
2023
2113
  `;
2024
- }
2025
2114
  }
2026
2115
  else {
2027
- if (Math.abs(y4 - y1) <= this.ganttUpper.styles.lineHeight) {
2028
- return `M ${x1} ${y1}
2029
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 - controlX} ${x1} ${y1 - controlY}
2030
- L ${x4} ${y4 + controlY}
2031
- C ${x4 - controlY} ${y4 + controlY} ${x4 - controlX} ${y4} ${x4} ${y4}
2116
+ controlX = this.ganttUpper.styles.lineHeight;
2117
+ return `M ${x1} ${y1}
2118
+ C ${x1 + controlX} ${y1} ${x1 + controlX} ${y4 > y1 ? y1 + controlX : y1 - controlX} ${centerX} ${centerY}
2119
+ C ${x4 - controlX} ${y4 > y1 ? y4 - controlX : y4 + controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
2032
2120
  `;
2033
- }
2034
- else {
2035
- controlX = this.ganttUpper.styles.lineHeight;
2036
- return `M ${x1} ${y1}
2037
- C ${x1 + controlX} ${y1} ${x1 + controlX} ${y1 - controlX} ${centerX} ${centerY}
2038
- C ${x4 - controlX} ${y4 + controlX} ${x4 - controlX} ${y4} ${x4} ${y4}
2039
- `;
2040
- }
2041
2121
  }
2042
2122
  }
2043
- else if (x4 - x1 < 100) {
2044
- const radius = Math.abs(y4 - y1) / 4;
2045
- let lindWidth = x4 - x1 - radius;
2046
- lindWidth = Math.max(lindWidth, radius);
2047
- return `M ${x1} ${y1}
2048
- L ${x1 + lindWidth} ${y1}
2049
- A ${radius} ${radius} 0 1 ${y4 > y1 ? 1 : 0} ${x1 + lindWidth} ${y4 > y1 ? y1 + 2 * radius : y1 - 2 * radius}
2050
- L ${x4 - lindWidth} ${y4 > y1 ? y1 + 2 * radius : y1 - 2 * radius}
2051
- A ${radius} ${radius} 0 1 ${y4 > y1 ? 0 : 1} ${x4 - lindWidth} ${y4}
2052
- L ${x4} ${y4}
2053
- `;
2123
+ else if (((_a = this.ganttUpper.linkOptions) === null || _a === void 0 ? void 0 : _a.showArrow) && x4 - x1 < 200) {
2124
+ dx = Math.max(Math.abs(y4 - y1) * bezierWeight, 60);
2125
+ x2 = x1 + dx;
2126
+ x3 = x4 - dx;
2127
+ return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
2054
2128
  }
2055
2129
  return `M ${x1} ${y1} C ${x2} ${y1} ${x3} ${y4} ${x4} ${y4}`;
2056
2130
  }
2057
2131
  };
2058
- GanttLinkPathCurve = __decorate([
2132
+ GanttLinkLineCurve = __decorate([
2059
2133
  __param(0, Inject(GANTT_UPPER_TOKEN))
2060
- ], GanttLinkPathCurve);
2134
+ ], GanttLinkLineCurve);
2061
2135
 
2062
- class GanttLinkPathLine extends GanttLinkPath {
2136
+ class GanttLinkLineStraight extends GanttLinkLine {
2063
2137
  constructor() {
2064
2138
  super();
2065
2139
  this.pathControl = 20;
@@ -2070,7 +2144,6 @@ class GanttLinkPathLine extends GanttLinkPath {
2070
2144
  const x4 = target.before.x;
2071
2145
  const y4 = target.before.y;
2072
2146
  const control = this.pathControl;
2073
- const centerY = (y1 + y4) / 2;
2074
2147
  return `M ${x1} ${y1}
2075
2148
  L ${x4 > x1 ? x1 - control : x4 - control} ${y1}
2076
2149
  L ${x4 > x1 ? x1 - control : x4 - control} ${y4}
@@ -2116,12 +2189,12 @@ class GanttLinkPathLine extends GanttLinkPath {
2116
2189
  }
2117
2190
  }
2118
2191
 
2119
- function generatePathFactory(type, ganttUpper) {
2192
+ function createLineGenerator(type, ganttUpper) {
2120
2193
  switch (type) {
2121
- case GanttLinkPathType.curve:
2122
- return new GanttLinkPathCurve(ganttUpper);
2123
- case GanttLinkPathType.line:
2124
- return new GanttLinkPathLine();
2194
+ case GanttLinkLineType.curve:
2195
+ return new GanttLinkLineCurve(ganttUpper);
2196
+ case GanttLinkLineType.straight:
2197
+ return new GanttLinkLineStraight();
2125
2198
  default:
2126
2199
  throw new Error('gantt link path type invalid');
2127
2200
  }
@@ -2145,7 +2218,7 @@ class GanttLinksComponent {
2145
2218
  this.ganttLinksOverlay = true;
2146
2219
  }
2147
2220
  ngOnInit() {
2148
- this.linkPath = generatePathFactory(this.ganttUpper.linkOptions.linkPathType, this.ganttUpper);
2221
+ this.linkLine = createLineGenerator(this.ganttUpper.linkOptions.lineType, this.ganttUpper);
2149
2222
  this.showArrow = this.ganttUpper.linkOptions.showArrow;
2150
2223
  this.buildLinks();
2151
2224
  this.firstChange = false;
@@ -2153,7 +2226,7 @@ class GanttLinksComponent {
2153
2226
  this.elementRef.nativeElement.style.visibility = 'hidden';
2154
2227
  });
2155
2228
  merge(this.ganttUpper.viewChange, this.ganttUpper.expandChange, this.ganttUpper.view.start$, this.ganttUpper.dragEnded, this.ganttUpper.linkDragEnded)
2156
- .pipe(takeUntil(this.unsubscribe$), skip(1), debounceTime(0))
2229
+ .pipe(skip(1), debounceTime(0), takeUntil(this.unsubscribe$))
2157
2230
  .subscribe(() => {
2158
2231
  this.elementRef.nativeElement.style.visibility = 'visible';
2159
2232
  this.buildLinks();
@@ -2212,16 +2285,30 @@ class GanttLinksComponent {
2212
2285
  source.links.forEach((link) => {
2213
2286
  const target = this.linkItems.find((item) => item.id === link.link);
2214
2287
  if (target && (target.origin.start || target.origin.end)) {
2215
- let color = LinkColors.default;
2288
+ let defaultColor = LinkColors.default;
2289
+ let activeColor = LinkColors.active;
2216
2290
  if (link.type === GanttLinkType.fs && source.end.getTime() > target.start.getTime()) {
2217
- color = LinkColors.blocked;
2291
+ defaultColor = LinkColors.blocked;
2292
+ activeColor = LinkColors.blocked;
2293
+ }
2294
+ if (link.color) {
2295
+ if (typeof link.color === 'string') {
2296
+ defaultColor = link.color;
2297
+ activeColor = link.color;
2298
+ }
2299
+ else {
2300
+ defaultColor = link.color.default;
2301
+ activeColor = link.color.active;
2302
+ }
2218
2303
  }
2219
2304
  this.links.push({
2220
- path: this.linkPath.generatePath(source, target, link.type),
2305
+ path: this.linkLine.generatePath(source, target, link.type),
2221
2306
  source: source.origin,
2222
2307
  target: target.origin,
2223
2308
  type: link.type,
2224
- color: link.color || color
2309
+ color: defaultColor,
2310
+ defaultColor,
2311
+ activeColor
2225
2312
  });
2226
2313
  }
2227
2314
  });
@@ -2238,24 +2325,24 @@ class GanttLinksComponent {
2238
2325
  target: link.target
2239
2326
  });
2240
2327
  }
2241
- mouseEnterPath(link) {
2242
- if (link.color === LinkColors.default) {
2243
- link.color = LinkColors.active;
2328
+ mouseEnterPath(link, index) {
2329
+ link.color = link.activeColor || link.defaultColor;
2330
+ if (index < this.links.length - 1) {
2331
+ this.links.splice(index, 1);
2332
+ this.links.push(link);
2244
2333
  }
2245
2334
  }
2246
2335
  mouseLeavePath(link) {
2247
- if (link.color === LinkColors.active) {
2248
- link.color = LinkColors.default;
2249
- }
2336
+ link.color = link.defaultColor;
2250
2337
  }
2251
2338
  ngOnDestroy() {
2252
2339
  this.unsubscribe$.next();
2253
2340
  this.unsubscribe$.complete();
2254
2341
  }
2255
2342
  }
2256
- 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 });
2257
- 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 [attr.style]=\"link.type === ganttLinkTypes.sf ? 'marker-start: url(#triangle' + i + ')' : '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 *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"] }] });
2258
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttLinksComponent, decorators: [{
2343
+ 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 });
2344
+ 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"] }] });
2345
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttLinksComponent, decorators: [{
2259
2346
  type: Component,
2260
2347
  args: [{
2261
2348
  selector: 'gantt-links-overlay',
@@ -2282,13 +2369,13 @@ class GanttItemUpper {
2282
2369
  this.firstChange = true;
2283
2370
  this.unsubscribe$ = new Subject();
2284
2371
  }
2285
- onInit() {
2372
+ ngOnInit() {
2286
2373
  this.firstChange = false;
2287
2374
  this.item.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2288
2375
  this.setPositions();
2289
2376
  });
2290
2377
  }
2291
- onChanges() {
2378
+ ngOnChanges() {
2292
2379
  if (!this.firstChange) {
2293
2380
  this.setPositions();
2294
2381
  }
@@ -2307,14 +2394,14 @@ class GanttItemUpper {
2307
2394
  else {
2308
2395
  }
2309
2396
  }
2310
- onDestroy() {
2397
+ ngOnDestroy() {
2311
2398
  this.unsubscribe$.next();
2312
2399
  this.unsubscribe$.complete();
2313
2400
  }
2314
2401
  }
2315
- 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 });
2316
- GanttItemUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.2", type: GanttItemUpper, inputs: { template: "template", item: "item" }, ngImport: i0 });
2317
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttItemUpper, decorators: [{
2402
+ 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 });
2403
+ GanttItemUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.5", type: GanttItemUpper, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0 });
2404
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttItemUpper, decorators: [{
2318
2405
  type: Directive
2319
2406
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2320
2407
  type: Inject,
@@ -2330,19 +2417,10 @@ class NgxGanttRangeComponent extends GanttItemUpper {
2330
2417
  super(elementRef, ganttUpper);
2331
2418
  this.ganttRangeClass = true;
2332
2419
  }
2333
- ngOnInit() {
2334
- super.onInit();
2335
- }
2336
- ngOnChanges() {
2337
- super.onChanges();
2338
- }
2339
- ngOnDestroy() {
2340
- super.onDestroy();
2341
- }
2342
2420
  }
2343
- 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 });
2344
- 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"] }] });
2345
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2421
+ 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 });
2422
+ 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, 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"] }] });
2423
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2346
2424
  type: Component,
2347
2425
  args: [{
2348
2426
  selector: 'ngx-gantt-range,gantt-range',
@@ -2358,17 +2436,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2358
2436
 
2359
2437
  const dragMinWidth = 10;
2360
2438
  const activeClass = 'gantt-bar-active';
2361
- const linkDropClass = 'gantt-bar-link-drop';
2439
+ const dropActiveClass = 'gantt-bar-drop-active';
2440
+ const singleDropActiveClass = 'gantt-bar-single-drop-active';
2362
2441
  function createSvgElement(qualifiedName, className) {
2363
2442
  const element = document.createElementNS('http://www.w3.org/2000/svg', qualifiedName);
2364
2443
  element.classList.add(className);
2365
2444
  return element;
2366
2445
  }
2367
2446
  class GanttBarDrag {
2368
- constructor(dragDrop, dom, dragContainer) {
2447
+ constructor(dragDrop, dom, dragContainer, root) {
2369
2448
  this.dragDrop = dragDrop;
2370
2449
  this.dom = dom;
2371
2450
  this.dragContainer = dragContainer;
2451
+ this.root = root;
2372
2452
  this.dragRefs = [];
2373
2453
  this.destroy$ = new Subject();
2374
2454
  }
@@ -2379,20 +2459,28 @@ class GanttBarDrag {
2379
2459
  return !this.item.linkable || !this.ganttUpper.linkable;
2380
2460
  }
2381
2461
  createMouseEvents() {
2382
- fromEvent(this.barElement, 'mouseenter')
2462
+ var _a, _b, _c;
2463
+ 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 &&
2464
+ ((_c = this.ganttUpper.config.linkOptions) === null || _c === void 0 ? void 0 : _c.dependencyTypes[0]) === GanttLinkType.fs
2465
+ ? singleDropActiveClass
2466
+ : dropActiveClass;
2467
+ fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
2383
2468
  .pipe(takeUntil(this.destroy$))
2384
2469
  .subscribe(() => {
2385
2470
  if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
2386
2471
  if (this.item.linkable) {
2387
- this.barElement.classList.add(linkDropClass);
2388
- this.dragContainer.emitLinkDragEntered(this.item);
2472
+ this.barElement.classList.add(dropClass);
2473
+ this.dragContainer.emitLinkDragEntered({
2474
+ item: this.item,
2475
+ element: this.barElement
2476
+ });
2389
2477
  }
2390
2478
  }
2391
2479
  else {
2392
2480
  this.barElement.classList.add(activeClass);
2393
2481
  }
2394
2482
  });
2395
- fromEvent(this.barElement, 'mouseleave')
2483
+ fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
2396
2484
  .pipe(takeUntil(this.destroy$))
2397
2485
  .subscribe(() => {
2398
2486
  if (!this.dragContainer.linkDraggingId) {
@@ -2401,7 +2489,7 @@ class GanttBarDrag {
2401
2489
  else {
2402
2490
  this.dragContainer.emitLinkDragLeaved();
2403
2491
  }
2404
- this.barElement.classList.remove(linkDropClass);
2492
+ this.barElement.classList.remove(dropClass);
2405
2493
  });
2406
2494
  }
2407
2495
  createBarDrag() {
@@ -2455,7 +2543,7 @@ class GanttBarDrag {
2455
2543
  if (width > dragMinWidth) {
2456
2544
  this.barElement.style.width = width + 'px';
2457
2545
  this.barElement.style.left = x + 'px';
2458
- this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(x), this.ganttUpper.view.getDateByXPoint(x + width));
2546
+ this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(x), this.item.end);
2459
2547
  this.item.updateDate(this.ganttUpper.view.getDateByXPoint(x), this.item.end);
2460
2548
  }
2461
2549
  }
@@ -2463,7 +2551,7 @@ class GanttBarDrag {
2463
2551
  const width = this.item.refs.width + event.distance.x;
2464
2552
  if (width > dragMinWidth) {
2465
2553
  this.barElement.style.width = width + 'px';
2466
- this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(this.item.refs.x), this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width));
2554
+ this.openDragBackdrop(this.barElement, this.item.start, this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width));
2467
2555
  }
2468
2556
  this.item.updateDate(this.item.start, this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width));
2469
2557
  }
@@ -2501,7 +2589,7 @@ class GanttBarDrag {
2501
2589
  const dragRefs = [];
2502
2590
  const handles = this.barElement.querySelectorAll('.link-handles .handle');
2503
2591
  handles.forEach((handle, index) => {
2504
- const isBefore = index === 0;
2592
+ const isBegin = index === 0;
2505
2593
  const dragRef = this.dragDrop.createDrag(handle);
2506
2594
  dragRef.withBoundaryElement(this.dom.root);
2507
2595
  dragRef.beforeStarted.subscribe(() => {
@@ -2510,46 +2598,59 @@ class GanttBarDrag {
2510
2598
  this.barDragRef.disabled = true;
2511
2599
  }
2512
2600
  this.createLinkDraggingLine();
2513
- this.dragContainer.emitLinkDragStarted(isBefore ? 'target' : 'source', this.item);
2601
+ this.dragContainer.emitLinkDragStarted({
2602
+ element: this.barElement,
2603
+ item: this.item,
2604
+ pos: isBegin ? InBarPosition.start : InBarPosition.finish
2605
+ });
2514
2606
  });
2515
2607
  dragRef.moved.subscribe(() => {
2516
- const positions = this.calcLinkLinePositions(handle, isBefore);
2608
+ const positions = this.calcLinkLinePositions(handle, isBegin);
2517
2609
  this.linkDraggingLine.setAttribute('x1', positions.x1.toString());
2518
2610
  this.linkDraggingLine.setAttribute('y1', positions.y1.toString());
2519
2611
  this.linkDraggingLine.setAttribute('x2', positions.x2.toString());
2520
2612
  this.linkDraggingLine.setAttribute('y2', positions.y2.toString());
2521
2613
  });
2522
2614
  dragRef.ended.subscribe((event) => {
2523
- event.source.reset();
2524
2615
  handle.style.pointerEvents = '';
2525
2616
  if (this.barDragRef) {
2526
2617
  this.barDragRef.disabled = false;
2527
2618
  }
2619
+ // 计算line拖动的落点位于目标Bar的值,如果值大于Bar宽度的一半,说明是拖动到Begin位置,否则则为拖动到End位置
2620
+ if (this.dragContainer.linkDragPath.to) {
2621
+ const placePointX = event.source.getRootElement().getBoundingClientRect().x -
2622
+ this.dragContainer.linkDragPath.to.element.getBoundingClientRect().x;
2623
+ this.dragContainer.emitLinkDragEnded(Object.assign(Object.assign({}, this.dragContainer.linkDragPath.to), { pos: placePointX < this.dragContainer.linkDragPath.to.item.refs.width / 2
2624
+ ? InBarPosition.start
2625
+ : InBarPosition.finish }));
2626
+ }
2627
+ event.source.reset();
2528
2628
  this.barElement.classList.remove(activeClass);
2529
2629
  this.destroyLinkDraggingLine();
2530
- this.dragContainer.emitLinkDragEnded();
2531
2630
  });
2532
2631
  dragRefs.push(dragRef);
2533
2632
  });
2534
2633
  return dragRefs;
2535
2634
  }
2536
2635
  openDragBackdrop(dragElement, start, end) {
2537
- const dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
2538
- const dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
2636
+ const dragBackdropElement = this.root.backdrop.nativeElement;
2637
+ const dragMaskElement = dragBackdropElement.querySelector('.gantt-drag-mask');
2539
2638
  const rootRect = this.dom.root.getBoundingClientRect();
2540
2639
  const dragRect = dragElement.getBoundingClientRect();
2541
2640
  const left = dragRect.left - rootRect.left - this.dom.side.clientWidth;
2542
2641
  const width = dragRect.right - dragRect.left;
2642
+ // Note: updating styles will cause re-layout so we have to place them consistently one by one.
2543
2643
  dragMaskElement.style.left = left + 'px';
2544
2644
  dragMaskElement.style.width = width + 'px';
2545
- dragMaskElement.querySelector('.start').innerHTML = start.format('MM-dd');
2546
- dragMaskElement.querySelector('.end').innerHTML = end.format('MM-dd');
2547
2645
  dragMaskElement.style.display = 'block';
2548
2646
  dragBackdropElement.style.display = 'block';
2647
+ // This will invalidate the layout, but we won't need re-layout, because we set styles previously.
2648
+ dragMaskElement.querySelector('.start').innerHTML = start.format('MM-dd');
2649
+ dragMaskElement.querySelector('.end').innerHTML = end.format('MM-dd');
2549
2650
  }
2550
2651
  closeDragBackdrop() {
2551
- const dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
2552
- const dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
2652
+ const dragBackdropElement = this.root.backdrop.nativeElement;
2653
+ const dragMaskElement = dragBackdropElement.querySelector('.gantt-drag-mask');
2553
2654
  dragMaskElement.style.display = 'none';
2554
2655
  dragBackdropElement.style.display = 'none';
2555
2656
  }
@@ -2576,6 +2677,7 @@ class GanttBarDrag {
2576
2677
  if (!this.linkDraggingLine) {
2577
2678
  const svgElement = createSvgElement('svg', 'gantt-link-drag-container');
2578
2679
  const linElement = createSvgElement('line', 'link-dragging-line');
2680
+ linElement.style.pointerEvents = 'none';
2579
2681
  svgElement.appendChild(linElement);
2580
2682
  this.dom.root.appendChild(svgElement);
2581
2683
  this.linkDraggingLine = linElement;
@@ -2614,27 +2716,30 @@ class GanttBarDrag {
2614
2716
  this.destroy$.complete();
2615
2717
  }
2616
2718
  }
2617
- 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 });
2618
- GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttBarDrag });
2619
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttBarDrag, decorators: [{
2719
+ GanttBarDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttBarDrag, deps: [{ token: i1.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }, { token: NgxGanttRootComponent, skipSelf: true }], target: i0.ɵɵFactoryTarget.Injectable });
2720
+ GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttBarDrag });
2721
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttBarDrag, decorators: [{
2620
2722
  type: Injectable
2621
- }], ctorParameters: function () { return [{ type: i1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }]; } });
2723
+ }], ctorParameters: function () { return [{ type: i1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: NgxGanttRootComponent, decorators: [{
2724
+ type: SkipSelf
2725
+ }] }]; } });
2622
2726
 
2623
2727
  function linearGradient(sideOrCorner, color, stop) {
2624
2728
  return `linear-gradient(${sideOrCorner},${color} 0%,${stop} 40%)`;
2625
2729
  }
2626
2730
  class NgxGanttBarComponent extends GanttItemUpper {
2627
- constructor(dragContainer, drag, elementRef, ganttUpper) {
2731
+ constructor(dragContainer, drag, elementRef, ganttUpper, ngZone) {
2628
2732
  super(elementRef, ganttUpper);
2629
2733
  this.dragContainer = dragContainer;
2630
2734
  this.drag = drag;
2631
2735
  this.ganttUpper = ganttUpper;
2736
+ this.ngZone = ngZone;
2632
2737
  this.barClick = new EventEmitter();
2633
2738
  this.ganttItemClass = true;
2634
2739
  this.color = 'red';
2635
2740
  }
2636
2741
  ngOnInit() {
2637
- super.onInit();
2742
+ super.ngOnInit();
2638
2743
  this.dragContainer.dragEnded.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2639
2744
  this.setContentBackground();
2640
2745
  });
@@ -2642,9 +2747,14 @@ class NgxGanttBarComponent extends GanttItemUpper {
2642
2747
  ngAfterViewInit() {
2643
2748
  this.drag.createDrags(this.elementRef, this.item, this.ganttUpper);
2644
2749
  this.setContentBackground();
2645
- }
2646
- ngOnChanges() {
2647
- super.onChanges();
2750
+ this.handles.changes
2751
+ .pipe(startWith(this.handles), switchMap(() =>
2752
+ // Note: we need to explicitly subscribe outside of the Angular zone since `addEventListener`
2753
+ // is called when the `fromEvent` is subscribed.
2754
+ new Observable((subscriber) => this.ngZone.runOutsideAngular(() => merge(...this.handles.toArray().map((handle) => fromEvent(handle.nativeElement, 'mousedown'))).subscribe(subscriber)))), takeUntil(this.unsubscribe$))
2755
+ .subscribe((event) => {
2756
+ event.stopPropagation();
2757
+ });
2648
2758
  }
2649
2759
  onBarClick(event) {
2650
2760
  this.barClick.emit({ event, item: this.item.origin });
@@ -2680,13 +2790,10 @@ class NgxGanttBarComponent extends GanttItemUpper {
2680
2790
  stopPropagation(event) {
2681
2791
  event.stopPropagation();
2682
2792
  }
2683
- ngOnDestroy() {
2684
- super.onDestroy();
2685
- }
2686
2793
  }
2687
- 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 });
2688
- 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"] }] });
2689
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
2794
+ 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 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
2795
+ 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 }, { propertyName: "handles", predicate: ["handle"], descendants: true }], usesInheritance: 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\" #handle></span>\n <span class=\"handle\" #handle></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"] }] });
2796
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
2690
2797
  type: Component,
2691
2798
  args: [{
2692
2799
  selector: 'ngx-gantt-bar,gantt-bar',
@@ -2696,7 +2803,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2696
2803
  }], ctorParameters: function () { return [{ type: GanttDragContainer }, { type: GanttBarDrag }, { type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2697
2804
  type: Inject,
2698
2805
  args: [GANTT_UPPER_TOKEN]
2699
- }] }]; }, propDecorators: { barClick: [{
2806
+ }] }, { type: i0.NgZone }]; }, propDecorators: { barClick: [{
2700
2807
  type: Output
2701
2808
  }], contentElementRef: [{
2702
2809
  type: ViewChild,
@@ -2704,6 +2811,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2704
2811
  }], ganttItemClass: [{
2705
2812
  type: HostBinding,
2706
2813
  args: ['class.gantt-bar']
2814
+ }], handles: [{
2815
+ type: ViewChildren,
2816
+ args: ['handle']
2707
2817
  }] } });
2708
2818
 
2709
2819
  class GanttMainComponent {
@@ -2713,14 +2823,13 @@ class GanttMainComponent {
2713
2823
  this.lineClick = new EventEmitter();
2714
2824
  this.ganttMainClass = true;
2715
2825
  }
2716
- ngOnInit() { }
2717
2826
  trackBy(index, item) {
2718
2827
  return item.id || index;
2719
2828
  }
2720
2829
  }
2721
- 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 });
2722
- 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;\">\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 } });
2723
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttMainComponent, decorators: [{
2830
+ 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 });
2831
+ 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 } });
2832
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttMainComponent, decorators: [{
2724
2833
  type: Component,
2725
2834
  args: [{
2726
2835
  selector: 'gantt-main',
@@ -2762,15 +2871,20 @@ class NgxGanttComponent extends GanttUpper {
2762
2871
  this.sideTableWidth = sideWidth;
2763
2872
  }
2764
2873
  ngOnInit() {
2765
- var _a;
2766
- super.onInit();
2767
- this.linkOptions = Object.assign({}, defaultConfig.linkOptions, (_a = this.config) === null || _a === void 0 ? void 0 : _a.linkOptions, this.linkOptions);
2768
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
2769
- this.dragContainer.linkDragStarted.pipe(takeUntil(this.ngUnsubscribe$)).subscribe((event) => {
2770
- this.linkDragStarted.emit(event);
2771
- });
2772
- this.dragContainer.linkDragEnded.pipe(takeUntil(this.ngUnsubscribe$)).subscribe((event) => {
2773
- this.linkDragEnded.emit(event);
2874
+ super.ngOnInit();
2875
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
2876
+ // the `onStable` will never emit any value.
2877
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
2878
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
2879
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
2880
+ this.ngZone.runOutsideAngular(() => {
2881
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2882
+ this.dragContainer.linkDragStarted.pipe(takeUntil(this.ngUnsubscribe$)).subscribe((event) => {
2883
+ this.linkDragStarted.emit(event);
2884
+ });
2885
+ this.dragContainer.linkDragEnded.pipe(takeUntil(this.ngUnsubscribe$)).subscribe((event) => {
2886
+ this.linkDragEnded.emit(event);
2887
+ });
2774
2888
  });
2775
2889
  });
2776
2890
  }
@@ -2784,9 +2898,6 @@ class NgxGanttComponent extends GanttUpper {
2784
2898
  this.cdr.detectChanges();
2785
2899
  });
2786
2900
  }
2787
- ngOnChanges(changes) {
2788
- super.onChanges(changes);
2789
- }
2790
2901
  expandChildren(item) {
2791
2902
  if (!item.expanded) {
2792
2903
  item.setExpand(true);
@@ -2822,20 +2933,17 @@ class NgxGanttComponent extends GanttUpper {
2822
2933
  this.selectionModel.toggle(selectedValue.id);
2823
2934
  const selectedIds = this.selectionModel.selected;
2824
2935
  if (this.multiple) {
2825
- const selectedValue = this.getGanttItems(selectedIds).map((item) => item.origin);
2826
- this.selectedChange.emit({ event, selectedValue });
2936
+ const _selectedValue = this.getGanttItems(selectedIds).map((item) => item.origin);
2937
+ this.selectedChange.emit({ event, selectedValue: _selectedValue });
2827
2938
  }
2828
2939
  else {
2829
- const selectedValue = (_a = this.getGanttItem(selectedIds[0])) === null || _a === void 0 ? void 0 : _a.origin;
2830
- this.selectedChange.emit({ event, selectedValue });
2940
+ const _selectedValue = (_a = this.getGanttItem(selectedIds[0])) === null || _a === void 0 ? void 0 : _a.origin;
2941
+ this.selectedChange.emit({ event, selectedValue: _selectedValue });
2831
2942
  }
2832
2943
  }
2833
- ngOnDestroy() {
2834
- super.onDestroy();
2835
- }
2836
2944
  }
2837
- 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 });
2838
- 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", linkOptions: "linkOptions" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick", selectedChange: "selectedChange" }, providers: [
2945
+ 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 });
2946
+ 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: [
2839
2947
  {
2840
2948
  provide: GANTT_UPPER_TOKEN,
2841
2949
  useExisting: NgxGanttComponent
@@ -2844,8 +2952,8 @@ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
2844
2952
  provide: GANTT_ABSTRACT_TOKEN,
2845
2953
  useExisting: forwardRef(() => NgxGanttComponent)
2846
2954
  }
2847
- ], 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 });
2848
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttComponent, decorators: [{
2955
+ ], 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, 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 });
2956
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttComponent, decorators: [{
2849
2957
  type: Component,
2850
2958
  args: [{
2851
2959
  selector: 'ngx-gantt',
@@ -2873,8 +2981,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2873
2981
  type: Input
2874
2982
  }], linkable: [{
2875
2983
  type: Input
2876
- }], linkOptions: [{
2877
- type: Input
2878
2984
  }], linkDragStarted: [{
2879
2985
  type: Output
2880
2986
  }], linkDragEnded: [{
@@ -2896,8 +3002,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2896
3002
 
2897
3003
  class NgxGanttModule {
2898
3004
  }
2899
- NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2900
- NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
3005
+ NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3006
+ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
2901
3007
  NgxGanttTableComponent,
2902
3008
  NgxGanttTableColumnComponent,
2903
3009
  GanttTableComponent,
@@ -2917,13 +3023,13 @@ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version:
2917
3023
  NgxGanttRootComponent,
2918
3024
  NgxGanttBarComponent,
2919
3025
  NgxGanttRangeComponent] });
2920
- NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, providers: [
3026
+ NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttModule, providers: [
2921
3027
  {
2922
3028
  provide: GANTT_GLOBAL_CONFIG,
2923
3029
  useValue: defaultConfig
2924
3030
  }
2925
3031
  ], imports: [[CommonModule, DragDropModule]] });
2926
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, decorators: [{
3032
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttModule, decorators: [{
2927
3033
  type: NgModule,
2928
3034
  args: [{
2929
3035
  imports: [CommonModule, DragDropModule],
@@ -2969,5 +3075,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2969
3075
  * Generated bundle index. Do not edit.
2970
3076
  */
2971
3077
 
2972
- export { GANTT_GLOBAL_CONFIG, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttDate, GanttDatePoint, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLoadOnScrollEvent, GanttPrintService, GanttSelectedEvent, GanttTableEvent, GanttUpper, GanttView, GanttViewType, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttRangeItemPipe, NgxGanttBarComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, defaultConfig, primaryDatePointTop, secondaryDatePointTop };
3078
+ 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 };
2973
3079
  //# sourceMappingURL=worktile-gantt.js.map