@worktile/gantt 12.2.0 → 12.2.3

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 (52) hide show
  1. package/bundles/worktile-gantt.umd.js +437 -388
  2. package/bundles/worktile-gantt.umd.js.map +1 -1
  3. package/class/link.d.ts +7 -2
  4. package/components/bar/bar-drag.d.ts +4 -2
  5. package/components/bar/bar.component.d.ts +4 -4
  6. package/components/calendar/calendar.component.d.ts +3 -5
  7. package/components/drag-backdrop/drag-backdrop.component.d.ts +1 -5
  8. package/components/icon/icon.component.d.ts +2 -4
  9. package/components/links/links.component.d.ts +1 -1
  10. package/components/main/gantt-main.component.d.ts +2 -3
  11. package/components/range/range.component.d.ts +2 -5
  12. package/components/table/gantt-table.component.d.ts +2 -3
  13. package/esm2015/class/link.js +1 -1
  14. package/esm2015/components/bar/bar-drag.js +31 -20
  15. package/esm2015/components/bar/bar.component.js +22 -15
  16. package/esm2015/components/calendar/calendar.component.js +18 -13
  17. package/esm2015/components/drag-backdrop/drag-backdrop.component.js +10 -14
  18. package/esm2015/components/icon/icon.component.js +4 -6
  19. package/esm2015/components/links/links.component.js +28 -14
  20. package/esm2015/components/main/gantt-main.component.js +4 -5
  21. package/esm2015/components/range/range.component.js +4 -13
  22. package/esm2015/components/table/gantt-table.component.js +10 -6
  23. package/esm2015/gantt-dom.service.js +41 -27
  24. package/esm2015/gantt-drag-container.js +17 -15
  25. package/esm2015/gantt-item-upper.js +7 -7
  26. package/esm2015/gantt-print.service.js +53 -50
  27. package/esm2015/gantt-upper.js +29 -20
  28. package/esm2015/gantt.component.js +20 -19
  29. package/esm2015/gantt.module.js +4 -4
  30. package/esm2015/gantt.pipe.js +9 -9
  31. package/esm2015/root.component.js +43 -31
  32. package/esm2015/table/gantt-column.component.js +4 -5
  33. package/esm2015/table/gantt-table.component.js +5 -6
  34. package/esm2015/utils/passive-listeners.js +30 -0
  35. package/esm2015/utils/set-style-with-vendor-prefix.js +15 -0
  36. package/esm2015/views/day.js +1 -1
  37. package/fesm2015/worktile-gantt.js +381 -281
  38. package/fesm2015/worktile-gantt.js.map +1 -1
  39. package/gantt-dom.service.d.ts +11 -4
  40. package/gantt-drag-container.d.ts +1 -1
  41. package/gantt-item-upper.d.ts +5 -5
  42. package/gantt-print.service.d.ts +1 -1
  43. package/gantt-upper.d.ts +5 -5
  44. package/gantt.component.d.ts +2 -4
  45. package/main.bundle.scss +3 -2
  46. package/package.json +1 -1
  47. package/root.component.d.ts +5 -3
  48. package/table/gantt-column.component.d.ts +2 -3
  49. package/table/gantt-table.component.d.ts +2 -4
  50. package/utils/passive-listeners.d.ts +13 -0
  51. package/utils/set-style-with-vendor-prefix.d.ts +12 -0
  52. package/README.md +0 -24
@@ -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) {
@@ -792,7 +791,9 @@ class GanttUpper {
792
791
  this.cdr = cdr;
793
792
  this.ngZone = ngZone;
794
793
  this.config = config;
794
+ // eslint-disable-next-line @angular-eslint/no-input-rename
795
795
  this.originItems = [];
796
+ // eslint-disable-next-line @angular-eslint/no-input-rename
796
797
  this.originGroups = [];
797
798
  this.viewType = GanttViewType.month;
798
799
  this.showTodayLine = true;
@@ -941,7 +942,7 @@ class GanttUpper {
941
942
  initSelectionModel() {
942
943
  return new SelectionModel(this.multiple, []);
943
944
  }
944
- onInit() {
945
+ ngOnInit() {
945
946
  this.styles = Object.assign({}, defaultStyles, this.styles);
946
947
  this.viewOptions.dateFormat = Object.assign({}, defaultConfig.dateFormat, this.config.dateFormat, this.viewOptions.dateFormat);
947
948
  this.createView();
@@ -950,25 +951,32 @@ class GanttUpper {
950
951
  this.computeRefs();
951
952
  this.initSelectionModel();
952
953
  this.firstChange = false;
953
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
954
- this.element.style.opacity = '1';
955
- this.dragContainer.dragStarted.subscribe((event) => {
956
- this.dragStarted.emit(event);
957
- });
958
- this.dragContainer.dragMoved.subscribe((event) => {
959
- this.dragMoved.emit(event);
960
- });
961
- this.dragContainer.dragEnded.subscribe((event) => {
962
- this.dragEnded.emit(event);
963
- this.computeRefs();
964
- 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
+ });
965
973
  });
966
974
  });
967
975
  this.view.start$.pipe(skip(1), takeUntil(this.unsubscribe$)).subscribe(() => {
968
976
  this.computeRefs();
969
977
  });
970
978
  }
971
- onChanges(changes) {
979
+ ngOnChanges(changes) {
972
980
  if (!this.firstChange) {
973
981
  if (changes.viewType && changes.viewType.currentValue) {
974
982
  this.createView();
@@ -985,7 +993,7 @@ class GanttUpper {
985
993
  }
986
994
  }
987
995
  }
988
- onDestroy() {
996
+ ngOnDestroy() {
989
997
  this.unsubscribe$.next();
990
998
  this.unsubscribe$.complete();
991
999
  }
@@ -1039,9 +1047,9 @@ class GanttUpper {
1039
1047
  return this.selectionModel.isSelected(id);
1040
1048
  }
1041
1049
  }
1042
- 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 });
1043
- 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", linkOptions: "linkOptions", disabledLoadOnScroll: "disabledLoadOnScroll", selectable: "selectable", multiple: "multiple" }, outputs: { loadOnScroll: "loadOnScroll", dragStarted: "dragStarted", dragMoved: "dragMoved", dragEnded: "dragEnded", barClick: "barClick" }, host: { properties: { "class.gantt": "this.ganttClass" } }, queries: [{ propertyName: "barTemplate", first: true, predicate: ["bar"], descendants: true, static: true }, { propertyName: "rangeTemplate", first: true, predicate: ["range"], descendants: true, static: true }, { propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, static: true }, { propertyName: "groupTemplate", first: true, predicate: ["group"], descendants: true, static: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ["groupHeader"], descendants: true, static: true }], ngImport: i0 });
1044
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.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: [{
1045
1053
  type: Directive
1046
1054
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
1047
1055
  type: Inject,
@@ -1112,11 +1120,10 @@ class NgxGanttTableColumnComponent {
1112
1120
  set width(width) {
1113
1121
  this.columnWidth = coerceCssPixelValue(width);
1114
1122
  }
1115
- ngOnInit() { }
1116
1123
  }
1117
- 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 });
1118
- 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 });
1119
- 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: [{
1120
1127
  type: Component,
1121
1128
  args: [{
1122
1129
  selector: 'ngx-gantt-column',
@@ -1141,17 +1148,16 @@ class NgxGanttTableComponent {
1141
1148
  constructor() {
1142
1149
  this.columnChanges = new EventEmitter();
1143
1150
  }
1144
- ngOnInit() { }
1145
1151
  }
1146
- NgxGanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1147
- 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 });
1148
- 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: [{
1149
1155
  type: Component,
1150
1156
  args: [{
1151
1157
  selector: 'ngx-gantt-table',
1152
1158
  template: ''
1153
1159
  }]
1154
- }], ctorParameters: function () { return []; }, propDecorators: { columnChanges: [{
1160
+ }], propDecorators: { columnChanges: [{
1155
1161
  type: Output
1156
1162
  }], rowBeforeTemplate: [{
1157
1163
  type: ContentChild,
@@ -1163,6 +1169,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1163
1169
 
1164
1170
  const GANTT_ABSTRACT_TOKEN = new InjectionToken('gantt-abstract-token');
1165
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
+
1166
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>`;
1167
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>`;
1168
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>`;
@@ -1258,8 +1279,6 @@ class GanttIconComponent {
1258
1279
  set iconName(name) {
1259
1280
  this.setSvg(name);
1260
1281
  }
1261
- ngOnInit() { }
1262
- ngAfterViewInit() { }
1263
1282
  setSvg(name) {
1264
1283
  const iconSvg = icons[name];
1265
1284
  if (iconSvg) {
@@ -1270,9 +1289,9 @@ class GanttIconComponent {
1270
1289
  }
1271
1290
  }
1272
1291
  }
1273
- GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1274
- 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 });
1275
- 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: [{
1276
1295
  type: Component,
1277
1296
  args: [{
1278
1297
  selector: 'gantt-icon',
@@ -1290,9 +1309,9 @@ class IsGanttRangeItemPipe {
1290
1309
  return value === GanttItemType.range;
1291
1310
  }
1292
1311
  }
1293
- IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1294
- IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1295
- 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: [{
1296
1315
  type: Pipe,
1297
1316
  args: [{
1298
1317
  name: 'isGanttRangeItem'
@@ -1303,9 +1322,9 @@ class IsGanttBarItemPipe {
1303
1322
  return value === GanttItemType.bar;
1304
1323
  }
1305
1324
  }
1306
- IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1307
- IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1308
- 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: [{
1309
1328
  type: Pipe,
1310
1329
  args: [{
1311
1330
  name: 'isGanttBarItem'
@@ -1316,9 +1335,9 @@ class IsGanttCustomItemPipe {
1316
1335
  return value === GanttItemType.custom;
1317
1336
  }
1318
1337
  }
1319
- IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1320
- IsGanttCustomItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1321
- 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: [{
1322
1341
  type: Pipe,
1323
1342
  args: [{
1324
1343
  name: 'isGanttCustomItem'
@@ -1344,7 +1363,6 @@ class GanttTableComponent {
1344
1363
  });
1345
1364
  this.columnList = columns;
1346
1365
  }
1347
- ngOnInit() { }
1348
1366
  ngOnChanges(changes) {
1349
1367
  var _a, _b;
1350
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)) {
@@ -1356,7 +1374,11 @@ class GanttTableComponent {
1356
1374
  }
1357
1375
  dragFixed(config) {
1358
1376
  if (config.movedWidth < config.minWidth) {
1359
- 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
+ });
1360
1382
  }
1361
1383
  }
1362
1384
  expandGroup(group) {
@@ -1437,9 +1459,9 @@ class GanttTableComponent {
1437
1459
  return item.id || index;
1438
1460
  }
1439
1461
  }
1440
- 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 });
1441
- 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 } });
1442
- 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: [{
1443
1465
  type: Component,
1444
1466
  args: [{
1445
1467
  selector: 'gantt-table',
@@ -1478,6 +1500,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1478
1500
  args: ['class.gantt-table-empty']
1479
1501
  }] } });
1480
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
+
1481
1533
  const scrollThreshold = 50;
1482
1534
  var ScrollDirection;
1483
1535
  (function (ScrollDirection) {
@@ -1486,24 +1538,26 @@ var ScrollDirection;
1486
1538
  ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1487
1539
  })(ScrollDirection || (ScrollDirection = {}));
1488
1540
  class GanttDomService {
1489
- constructor() {
1541
+ constructor(ngZone, platformId) {
1542
+ this.ngZone = ngZone;
1543
+ this.platformId = platformId;
1490
1544
  this.unsubscribe$ = new Subject();
1491
1545
  }
1492
1546
  monitorScrollChange() {
1493
- merge(fromEvent(this.mainContainer, 'scroll'), fromEvent(this.sideContainer, 'scroll'))
1547
+ this.ngZone.runOutsideAngular(() => merge(fromEvent(this.mainContainer, 'scroll', passiveListenerOptions), fromEvent(this.sideContainer, 'scroll', passiveListenerOptions))
1494
1548
  .pipe(takeUntil(this.unsubscribe$))
1495
1549
  .subscribe((event) => {
1496
1550
  this.syncScroll(event);
1497
- });
1498
- fromEvent(this.mainContainer, 'scroll')
1499
- .pipe(startWith(), takeUntil(this.unsubscribe$))
1500
- .subscribe((event) => {
1501
- // if (this.mainContainer.scrollLeft > 0) {
1502
- // this.side.classList.add('gantt-side-has-shadow');
1503
- // } else {
1504
- // this.side.classList.remove('gantt-side-has-shadow');
1505
- // }
1506
- });
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
+ // });
1507
1561
  }
1508
1562
  syncScroll(event) {
1509
1563
  const target = event.currentTarget;
@@ -1513,7 +1567,7 @@ class GanttDomService {
1513
1567
  }
1514
1568
  disableBrowserWheelEvent() {
1515
1569
  const container = this.mainContainer;
1516
- fromEvent(container, 'wheel')
1570
+ this.ngZone.runOutsideAngular(() => fromEvent(container, 'wheel')
1517
1571
  .pipe(takeUntil(this.unsubscribe$))
1518
1572
  .subscribe((event) => {
1519
1573
  const delta = event.deltaX;
@@ -1524,7 +1578,7 @@ class GanttDomService {
1524
1578
  (container.scrollLeft === 0 && delta < 0)) {
1525
1579
  event.preventDefault();
1526
1580
  }
1527
- });
1581
+ }));
1528
1582
  }
1529
1583
  initialize(root) {
1530
1584
  this.root = root.nativeElement;
@@ -1536,8 +1590,13 @@ class GanttDomService {
1536
1590
  this.monitorScrollChange();
1537
1591
  this.disableBrowserWheelEvent();
1538
1592
  }
1539
- getViewerScroll() {
1540
- 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]) => {
1541
1600
  const event = {
1542
1601
  target: this.mainContainer,
1543
1602
  direction: ScrollDirection.NONE
@@ -1548,15 +1607,17 @@ class GanttDomService {
1548
1607
  }
1549
1608
  }
1550
1609
  if (current - previous > 0) {
1551
- if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft < scrollThreshold) {
1610
+ if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft <
1611
+ scrollThreshold) {
1552
1612
  event.direction = ScrollDirection.RIGHT;
1553
1613
  }
1554
1614
  }
1555
1615
  return event;
1556
- }));
1616
+ }))
1617
+ .subscribe(subscriber)));
1557
1618
  }
1558
1619
  getResize() {
1559
- return fromEvent(window, 'resize').pipe(auditTime(150));
1620
+ return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
1560
1621
  }
1561
1622
  scrollMainContainer(left) {
1562
1623
  if (isNumber(left)) {
@@ -1570,11 +1631,14 @@ class GanttDomService {
1570
1631
  this.unsubscribe$.complete();
1571
1632
  }
1572
1633
  }
1573
- GanttDomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1574
- GanttDomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService });
1575
- 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: [{
1576
1637
  type: Injectable
1577
- }], ctorParameters: function () { return []; } });
1638
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: undefined, decorators: [{
1639
+ type: Inject,
1640
+ args: [PLATFORM_ID]
1641
+ }] }]; } });
1578
1642
 
1579
1643
  function getDependencyType(path, dependencyTypes) {
1580
1644
  if (dependencyTypes.includes(GanttLinkType.ss) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.start) {
@@ -1624,30 +1688,47 @@ class GanttDragContainer {
1624
1688
  }
1625
1689
  emitLinkDragEnded(to) {
1626
1690
  var _a;
1627
- this.linkDragPath.to = to;
1628
- const dependencyType = getDependencyType(this.linkDragPath, (_a = this.ganttUpper.linkOptions) === null || _a === void 0 ? void 0 : _a.dependencyTypes);
1629
- this.linkDragPath.from.item.addLink({
1630
- link: this.linkDragPath.to.item.id,
1631
- type: dependencyType
1632
- });
1633
- this.linkDragEnded.emit({
1634
- source: this.linkDragPath.from.item.origin,
1635
- target: this.linkDragPath.to.item.origin,
1636
- type: dependencyType
1637
- });
1691
+ if (to) {
1692
+ this.linkDragPath.to = to;
1693
+ const dependencyType = getDependencyType(this.linkDragPath, (_a = this.ganttUpper.linkOptions) === null || _a === void 0 ? void 0 : _a.dependencyTypes);
1694
+ this.linkDragPath.from.item.addLink({
1695
+ link: this.linkDragPath.to.item.id,
1696
+ type: dependencyType
1697
+ });
1698
+ this.linkDragEnded.emit({
1699
+ source: this.linkDragPath.from.item.origin,
1700
+ target: this.linkDragPath.to.item.origin,
1701
+ type: dependencyType
1702
+ });
1703
+ }
1638
1704
  this.linkDraggingId = null;
1639
1705
  this.linkDragPath = { from: null, to: null };
1640
1706
  }
1641
1707
  }
1642
- GanttDragContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
1643
- GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer });
1644
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer, decorators: [{
1708
+ 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 });
1709
+ GanttDragContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDragContainer });
1710
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDragContainer, decorators: [{
1645
1711
  type: Injectable
1646
1712
  }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
1647
1713
  type: Inject,
1648
1714
  args: [GANTT_UPPER_TOKEN]
1649
1715
  }] }]; } });
1650
1716
 
1717
+ class GanttDragBackdropComponent {
1718
+ }
1719
+ GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1720
+ 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" });
1721
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
1722
+ type: Component,
1723
+ args: [{
1724
+ selector: 'gantt-drag-backdrop',
1725
+ templateUrl: `./drag-backdrop.component.html`,
1726
+ host: {
1727
+ class: 'gantt-drag-backdrop'
1728
+ }
1729
+ }]
1730
+ }] });
1731
+
1651
1732
  class GanttPrintService {
1652
1733
  constructor() { }
1653
1734
  setInlineStyles(targetElem) {
@@ -1684,58 +1765,61 @@ class GanttPrintService {
1684
1765
  this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1685
1766
  }
1686
1767
  print(name = 'download', ignoreElementClass) {
1687
- const root = this.root;
1688
- const mainContainer = this.mainContainer;
1689
- // set print width
1690
- const printWidth = root.offsetWidth;
1691
- // set print height
1692
- const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
1693
- html2canvas(root, {
1694
- logging: false,
1695
- allowTaint: true,
1696
- useCORS: true,
1697
- width: printWidth,
1698
- height: printHeight,
1699
- ignoreElements: (element) => {
1700
- if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
1701
- return true;
1702
- }
1703
- if (element.classList.contains('gantt-calendar-today-overlay')) {
1704
- return true;
1705
- }
1706
- },
1707
- onclone: (cloneDocument) => {
1708
- const ganttClass = root.className;
1709
- const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
1710
- const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
1711
- const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
1712
- const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
1713
- // change targetDom width
1714
- cloneGanttDom.style.width = `${printWidth}px`;
1715
- cloneGanttDom.style.height = `${printHeight}px`;
1716
- cloneGanttDom.style.overflow = `unset`;
1717
- cloneGanttContainerDom.style.backgroundColor = '#fff';
1718
- cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
1719
- cloneCalendarOverlay.setAttribute('style', `background: transparent`);
1720
- if (cloneLinksOverlay) {
1721
- cloneLinksOverlay.setAttribute('height', `${printHeight}`);
1722
- cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
1768
+ return __awaiter(this, void 0, void 0, function* () {
1769
+ const root = this.root;
1770
+ const mainContainer = this.mainContainer;
1771
+ // set print width
1772
+ const printWidth = root.offsetWidth;
1773
+ // set print height
1774
+ const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
1775
+ const html2canvas = (yield import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')).default;
1776
+ html2canvas(root, {
1777
+ logging: false,
1778
+ allowTaint: true,
1779
+ useCORS: true,
1780
+ width: printWidth,
1781
+ height: printHeight,
1782
+ ignoreElements: (element) => {
1783
+ if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
1784
+ return true;
1785
+ }
1786
+ if (element.classList.contains('gantt-calendar-today-overlay')) {
1787
+ return true;
1788
+ }
1789
+ },
1790
+ onclone: (cloneDocument) => {
1791
+ const ganttClass = root.className;
1792
+ const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
1793
+ const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
1794
+ const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
1795
+ const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
1796
+ // change targetDom width
1797
+ cloneGanttDom.style.width = `${printWidth}px`;
1798
+ cloneGanttDom.style.height = `${printHeight}px`;
1799
+ cloneGanttDom.style.overflow = `unset`;
1800
+ cloneGanttContainerDom.style.backgroundColor = '#fff';
1801
+ cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
1802
+ cloneCalendarOverlay.setAttribute('style', `background: transparent`);
1803
+ if (cloneLinksOverlay) {
1804
+ cloneLinksOverlay.setAttribute('height', `${printHeight}`);
1805
+ cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
1806
+ }
1807
+ // setInlineStyles for svg
1808
+ this.setInlineStyles(cloneGanttDom);
1723
1809
  }
1724
- // setInlineStyles for svg
1725
- this.setInlineStyles(cloneGanttDom);
1726
- }
1727
- }).then((canvas) => {
1728
- const link = document.createElement('a');
1729
- const dataUrl = canvas.toDataURL('image/png');
1730
- link.download = `${name}.png`;
1731
- link.href = dataUrl;
1732
- link.click();
1810
+ }).then((canvas) => {
1811
+ const link = document.createElement('a');
1812
+ const dataUrl = canvas.toDataURL('image/png');
1813
+ link.download = `${name}.png`;
1814
+ link.href = dataUrl;
1815
+ link.click();
1816
+ });
1733
1817
  });
1734
1818
  }
1735
1819
  }
1736
- GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1737
- GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService });
1738
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService, decorators: [{
1820
+ GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1821
+ GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttPrintService });
1822
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttPrintService, decorators: [{
1739
1823
  type: Injectable
1740
1824
  }], ctorParameters: function () { return []; } });
1741
1825
 
@@ -1745,7 +1829,6 @@ class GanttCalendarComponent {
1745
1829
  this.ganttUpper = ganttUpper;
1746
1830
  this.ngZone = ngZone;
1747
1831
  this.elementRef = elementRef;
1748
- this.unsubscribe$ = new Subject();
1749
1832
  this.headerHeight = headerHeight;
1750
1833
  this.mainHeight = mainHeight;
1751
1834
  this.todayHeight = todayHeight;
@@ -1753,6 +1836,7 @@ class GanttCalendarComponent {
1753
1836
  this.todayBorderRadius = todayBorderRadius;
1754
1837
  this.viewTypes = GanttViewType;
1755
1838
  this.className = true;
1839
+ this.unsubscribe$ = new Subject();
1756
1840
  }
1757
1841
  get view() {
1758
1842
  return this.ganttUpper.view;
@@ -1780,16 +1864,21 @@ class GanttCalendarComponent {
1780
1864
  }
1781
1865
  }
1782
1866
  ngOnInit() {
1783
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
1784
- merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
1785
- .pipe(takeUntil(this.unsubscribe$))
1786
- .subscribe(() => {
1787
- this.setTodayPoint();
1867
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
1868
+ // the `onStable` will never emit any value.
1869
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
1870
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
1871
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
1872
+ this.ngZone.runOutsideAngular(() => {
1873
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1874
+ merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
1875
+ .pipe(takeUntil(this.unsubscribe$))
1876
+ .subscribe(() => {
1877
+ this.setTodayPoint();
1878
+ });
1788
1879
  });
1789
1880
  });
1790
1881
  }
1791
- ngAfterViewInit() { }
1792
- ngOnChanges(changes) { }
1793
1882
  trackBy(index, point) {
1794
1883
  return point.text || index;
1795
1884
  }
@@ -1798,9 +1887,9 @@ class GanttCalendarComponent {
1798
1887
  this.unsubscribe$.complete();
1799
1888
  }
1800
1889
  }
1801
- 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 });
1802
- 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"] }] });
1803
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttCalendarComponent, decorators: [{
1890
+ 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 });
1891
+ 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"] }] });
1892
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttCalendarComponent, decorators: [{
1804
1893
  type: Component,
1805
1894
  args: [{
1806
1895
  selector: 'gantt-calendar-overlay',
@@ -1814,25 +1903,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1814
1903
  args: ['class.gantt-calendar-overlay']
1815
1904
  }] } });
1816
1905
 
1817
- class GanttDragBackdropComponent {
1818
- constructor() {
1819
- this.backdropClass = true;
1820
- }
1821
- ngOnInit() { }
1822
- }
1823
- GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1824
- 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" });
1825
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
1826
- type: Component,
1827
- args: [{
1828
- selector: 'gantt-drag-backdrop',
1829
- templateUrl: `./drag-backdrop.component.html`
1830
- }]
1831
- }], ctorParameters: function () { return []; }, propDecorators: { backdropClass: [{
1832
- type: HostBinding,
1833
- args: ['class.gantt-drag-backdrop']
1834
- }] } });
1835
-
1836
1906
  class NgxGanttRootComponent {
1837
1907
  constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
1838
1908
  this.elementRef = elementRef;
@@ -1841,7 +1911,6 @@ class NgxGanttRootComponent {
1841
1911
  this.dragContainer = dragContainer;
1842
1912
  this.ganttUpper = ganttUpper;
1843
1913
  this.printService = printService;
1844
- this.ganttClass = true;
1845
1914
  this.unsubscribe$ = new Subject();
1846
1915
  this.ganttUpper.dragContainer = dragContainer;
1847
1916
  }
@@ -1849,44 +1918,52 @@ class NgxGanttRootComponent {
1849
1918
  return this.ganttUpper.view;
1850
1919
  }
1851
1920
  ngOnInit() {
1852
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
1853
- this.dom.initialize(this.elementRef);
1854
- if (this.printService) {
1855
- this.printService.register(this.elementRef);
1856
- }
1857
- this.setupScrollClass();
1858
- this.setupResize();
1859
- this.setupViewScroll();
1860
- // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
1861
- this.elementRef.nativeElement.style.opacity = '1';
1862
- this.ganttUpper.viewChange.pipe(startWith(null)).subscribe(() => {
1863
- this.scrollToToday();
1921
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
1922
+ // the `onStable` will never emit any value.
1923
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
1924
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
1925
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
1926
+ this.ngZone.runOutsideAngular(() => {
1927
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1928
+ this.dom.initialize(this.elementRef);
1929
+ if (this.printService) {
1930
+ this.printService.register(this.elementRef);
1931
+ }
1932
+ this.setupScrollClass();
1933
+ this.setupResize();
1934
+ this.setupViewScroll();
1935
+ // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
1936
+ this.elementRef.nativeElement.style.opacity = '1';
1937
+ this.ganttUpper.viewChange.pipe(startWith(null), takeUntil(this.unsubscribe$)).subscribe(() => {
1938
+ this.scrollToToday();
1939
+ });
1864
1940
  });
1865
1941
  });
1866
1942
  }
1943
+ ngOnDestroy() {
1944
+ this.unsubscribe$.next();
1945
+ }
1867
1946
  setupViewScroll() {
1868
1947
  if (this.ganttUpper.disabledLoadOnScroll) {
1869
1948
  return;
1870
1949
  }
1871
1950
  this.dom
1872
- .getViewerScroll()
1951
+ .getViewerScroll(passiveListenerOptions)
1873
1952
  .pipe(takeUntil(this.unsubscribe$))
1874
1953
  .subscribe((event) => {
1875
1954
  if (event.direction === ScrollDirection.LEFT) {
1876
1955
  const dates = this.view.addStartDate();
1877
1956
  if (dates) {
1878
1957
  event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
1879
- this.ngZone.run(() => {
1880
- this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() });
1881
- });
1958
+ if (this.ganttUpper.loadOnScroll.observers) {
1959
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
1960
+ }
1882
1961
  }
1883
1962
  }
1884
1963
  if (event.direction === ScrollDirection.RIGHT) {
1885
1964
  const dates = this.view.addEndDate();
1886
- if (dates) {
1887
- this.ngZone.run(() => {
1888
- this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() });
1889
- });
1965
+ if (dates && this.ganttUpper.loadOnScroll.observers) {
1966
+ this.ngZone.run(() => this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() }));
1890
1967
  }
1891
1968
  }
1892
1969
  });
@@ -1915,14 +1992,17 @@ class NgxGanttRootComponent {
1915
1992
  this.dom.scrollMainContainer(x);
1916
1993
  }
1917
1994
  }
1918
- 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 });
1919
- 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"] }] });
1920
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
1995
+ 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 });
1996
+ 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"] }] });
1997
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
1921
1998
  type: Component,
1922
1999
  args: [{
1923
2000
  selector: 'ngx-gantt-root',
1924
2001
  templateUrl: './root.component.html',
1925
- providers: [GanttDomService, GanttDragContainer]
2002
+ providers: [GanttDomService, GanttDragContainer],
2003
+ host: {
2004
+ class: 'gantt'
2005
+ }
1926
2006
  }]
1927
2007
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
1928
2008
  type: Inject,
@@ -1931,15 +2011,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1931
2011
  type: Optional
1932
2012
  }] }]; }, propDecorators: { sideWidth: [{
1933
2013
  type: Input
1934
- }], ganttClass: [{
1935
- type: HostBinding,
1936
- args: ['class.gantt']
1937
2014
  }], sideTemplate: [{
1938
2015
  type: ContentChild,
1939
2016
  args: ['sideTemplate', { static: true }]
1940
2017
  }], mainTemplate: [{
1941
2018
  type: ContentChild,
1942
2019
  args: ['mainTemplate', { static: true }]
2020
+ }], backdrop: [{
2021
+ type: ViewChild,
2022
+ args: [GanttDragBackdropComponent, { static: true, read: ElementRef }]
1943
2023
  }] } });
1944
2024
 
1945
2025
  class GanttLinkLine {
@@ -2148,7 +2228,7 @@ class GanttLinksComponent {
2148
2228
  this.elementRef.nativeElement.style.visibility = 'hidden';
2149
2229
  });
2150
2230
  merge(this.ganttUpper.viewChange, this.ganttUpper.expandChange, this.ganttUpper.view.start$, this.ganttUpper.dragEnded, this.ganttUpper.linkDragEnded)
2151
- .pipe(takeUntil(this.unsubscribe$), skip(1), debounceTime(0))
2231
+ .pipe(skip(1), debounceTime(0), takeUntil(this.unsubscribe$))
2152
2232
  .subscribe(() => {
2153
2233
  this.elementRef.nativeElement.style.visibility = 'visible';
2154
2234
  this.buildLinks();
@@ -2207,16 +2287,30 @@ class GanttLinksComponent {
2207
2287
  source.links.forEach((link) => {
2208
2288
  const target = this.linkItems.find((item) => item.id === link.link);
2209
2289
  if (target && (target.origin.start || target.origin.end)) {
2210
- let color = LinkColors.default;
2290
+ let defaultColor = LinkColors.default;
2291
+ let activeColor = LinkColors.active;
2211
2292
  if (link.type === GanttLinkType.fs && source.end.getTime() > target.start.getTime()) {
2212
- color = LinkColors.blocked;
2293
+ defaultColor = LinkColors.blocked;
2294
+ activeColor = LinkColors.blocked;
2295
+ }
2296
+ if (link.color) {
2297
+ if (typeof link.color === 'string') {
2298
+ defaultColor = link.color;
2299
+ activeColor = link.color;
2300
+ }
2301
+ else {
2302
+ defaultColor = link.color.default;
2303
+ activeColor = link.color.active;
2304
+ }
2213
2305
  }
2214
2306
  this.links.push({
2215
2307
  path: this.linkLine.generatePath(source, target, link.type),
2216
2308
  source: source.origin,
2217
2309
  target: target.origin,
2218
2310
  type: link.type,
2219
- color: link.color || color
2311
+ color: defaultColor,
2312
+ defaultColor,
2313
+ activeColor
2220
2314
  });
2221
2315
  }
2222
2316
  });
@@ -2233,24 +2327,24 @@ class GanttLinksComponent {
2233
2327
  target: link.target
2234
2328
  });
2235
2329
  }
2236
- mouseEnterPath(link) {
2237
- if (link.color === LinkColors.default) {
2238
- link.color = LinkColors.active;
2330
+ mouseEnterPath(link, index) {
2331
+ link.color = link.activeColor || link.defaultColor;
2332
+ if (index < this.links.length - 1) {
2333
+ this.links.splice(index, 1);
2334
+ this.links.push(link);
2239
2335
  }
2240
2336
  }
2241
2337
  mouseLeavePath(link) {
2242
- if (link.color === LinkColors.active) {
2243
- link.color = LinkColors.default;
2244
- }
2338
+ link.color = link.defaultColor;
2245
2339
  }
2246
2340
  ngOnDestroy() {
2247
2341
  this.unsubscribe$.next();
2248
2342
  this.unsubscribe$.complete();
2249
2343
  }
2250
2344
  }
2251
- 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 });
2252
- 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"] }] });
2253
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttLinksComponent, decorators: [{
2345
+ 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 });
2346
+ 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"] }] });
2347
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttLinksComponent, decorators: [{
2254
2348
  type: Component,
2255
2349
  args: [{
2256
2350
  selector: 'gantt-links-overlay',
@@ -2277,13 +2371,13 @@ class GanttItemUpper {
2277
2371
  this.firstChange = true;
2278
2372
  this.unsubscribe$ = new Subject();
2279
2373
  }
2280
- onInit() {
2374
+ ngOnInit() {
2281
2375
  this.firstChange = false;
2282
2376
  this.item.refs$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2283
2377
  this.setPositions();
2284
2378
  });
2285
2379
  }
2286
- onChanges() {
2380
+ ngOnChanges() {
2287
2381
  if (!this.firstChange) {
2288
2382
  this.setPositions();
2289
2383
  }
@@ -2302,14 +2396,14 @@ class GanttItemUpper {
2302
2396
  else {
2303
2397
  }
2304
2398
  }
2305
- onDestroy() {
2399
+ ngOnDestroy() {
2306
2400
  this.unsubscribe$.next();
2307
2401
  this.unsubscribe$.complete();
2308
2402
  }
2309
2403
  }
2310
- 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 });
2311
- GanttItemUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.2", type: GanttItemUpper, inputs: { template: "template", item: "item" }, ngImport: i0 });
2312
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttItemUpper, decorators: [{
2404
+ 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 });
2405
+ GanttItemUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.5", type: GanttItemUpper, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0 });
2406
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttItemUpper, decorators: [{
2313
2407
  type: Directive
2314
2408
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2315
2409
  type: Inject,
@@ -2325,19 +2419,10 @@ class NgxGanttRangeComponent extends GanttItemUpper {
2325
2419
  super(elementRef, ganttUpper);
2326
2420
  this.ganttRangeClass = true;
2327
2421
  }
2328
- ngOnInit() {
2329
- super.onInit();
2330
- }
2331
- ngOnChanges() {
2332
- super.onChanges();
2333
- }
2334
- ngOnDestroy() {
2335
- super.onDestroy();
2336
- }
2337
2422
  }
2338
- 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 });
2339
- 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"] }] });
2340
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2423
+ 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 });
2424
+ 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"] }] });
2425
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2341
2426
  type: Component,
2342
2427
  args: [{
2343
2428
  selector: 'ngx-gantt-range,gantt-range',
@@ -2361,10 +2446,11 @@ function createSvgElement(qualifiedName, className) {
2361
2446
  return element;
2362
2447
  }
2363
2448
  class GanttBarDrag {
2364
- constructor(dragDrop, dom, dragContainer) {
2449
+ constructor(dragDrop, dom, dragContainer, root) {
2365
2450
  this.dragDrop = dragDrop;
2366
2451
  this.dom = dom;
2367
2452
  this.dragContainer = dragContainer;
2453
+ this.root = root;
2368
2454
  this.dragRefs = [];
2369
2455
  this.destroy$ = new Subject();
2370
2456
  }
@@ -2380,9 +2466,9 @@ class GanttBarDrag {
2380
2466
  ((_c = this.ganttUpper.config.linkOptions) === null || _c === void 0 ? void 0 : _c.dependencyTypes[0]) === GanttLinkType.fs
2381
2467
  ? singleDropActiveClass
2382
2468
  : dropActiveClass;
2383
- fromEvent(this.barElement, 'mouseenter')
2469
+ fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
2384
2470
  .pipe(takeUntil(this.destroy$))
2385
- .subscribe((event) => {
2471
+ .subscribe(() => {
2386
2472
  if (this.dragContainer.linkDraggingId && this.dragContainer.linkDraggingId !== this.item.id) {
2387
2473
  if (this.item.linkable) {
2388
2474
  this.barElement.classList.add(dropClass);
@@ -2396,9 +2482,9 @@ class GanttBarDrag {
2396
2482
  this.barElement.classList.add(activeClass);
2397
2483
  }
2398
2484
  });
2399
- fromEvent(this.barElement, 'mouseleave')
2485
+ fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
2400
2486
  .pipe(takeUntil(this.destroy$))
2401
- .subscribe((event) => {
2487
+ .subscribe(() => {
2402
2488
  if (!this.dragContainer.linkDraggingId) {
2403
2489
  this.barElement.classList.remove(activeClass);
2404
2490
  }
@@ -2459,7 +2545,7 @@ class GanttBarDrag {
2459
2545
  if (width > dragMinWidth) {
2460
2546
  this.barElement.style.width = width + 'px';
2461
2547
  this.barElement.style.left = x + 'px';
2462
- this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(x), this.ganttUpper.view.getDateByXPoint(x + width));
2548
+ this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(x), this.item.end);
2463
2549
  this.item.updateDate(this.ganttUpper.view.getDateByXPoint(x), this.item.end);
2464
2550
  }
2465
2551
  }
@@ -2467,7 +2553,7 @@ class GanttBarDrag {
2467
2553
  const width = this.item.refs.width + event.distance.x;
2468
2554
  if (width > dragMinWidth) {
2469
2555
  this.barElement.style.width = width + 'px';
2470
- this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(this.item.refs.x), this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width));
2556
+ this.openDragBackdrop(this.barElement, this.item.start, this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width));
2471
2557
  }
2472
2558
  this.item.updateDate(this.item.start, this.ganttUpper.view.getDateByXPoint(this.item.refs.x + width));
2473
2559
  }
@@ -2540,6 +2626,9 @@ class GanttBarDrag {
2540
2626
  ? InBarPosition.start
2541
2627
  : InBarPosition.finish }));
2542
2628
  }
2629
+ else {
2630
+ this.dragContainer.emitLinkDragEnded();
2631
+ }
2543
2632
  event.source.reset();
2544
2633
  this.barElement.classList.remove(activeClass);
2545
2634
  this.destroyLinkDraggingLine();
@@ -2549,22 +2638,24 @@ class GanttBarDrag {
2549
2638
  return dragRefs;
2550
2639
  }
2551
2640
  openDragBackdrop(dragElement, start, end) {
2552
- const dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
2553
- const dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
2641
+ const dragBackdropElement = this.root.backdrop.nativeElement;
2642
+ const dragMaskElement = dragBackdropElement.querySelector('.gantt-drag-mask');
2554
2643
  const rootRect = this.dom.root.getBoundingClientRect();
2555
2644
  const dragRect = dragElement.getBoundingClientRect();
2556
2645
  const left = dragRect.left - rootRect.left - this.dom.side.clientWidth;
2557
2646
  const width = dragRect.right - dragRect.left;
2647
+ // Note: updating styles will cause re-layout so we have to place them consistently one by one.
2558
2648
  dragMaskElement.style.left = left + 'px';
2559
2649
  dragMaskElement.style.width = width + 'px';
2560
- dragMaskElement.querySelector('.start').innerHTML = start.format('MM-dd');
2561
- dragMaskElement.querySelector('.end').innerHTML = end.format('MM-dd');
2562
2650
  dragMaskElement.style.display = 'block';
2563
2651
  dragBackdropElement.style.display = 'block';
2652
+ // This will invalidate the layout, but we won't need re-layout, because we set styles previously.
2653
+ dragMaskElement.querySelector('.start').innerHTML = start.format('MM-dd');
2654
+ dragMaskElement.querySelector('.end').innerHTML = end.format('MM-dd');
2564
2655
  }
2565
2656
  closeDragBackdrop() {
2566
- const dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
2567
- const dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
2657
+ const dragBackdropElement = this.root.backdrop.nativeElement;
2658
+ const dragMaskElement = dragBackdropElement.querySelector('.gantt-drag-mask');
2568
2659
  dragMaskElement.style.display = 'none';
2569
2660
  dragBackdropElement.style.display = 'none';
2570
2661
  }
@@ -2607,7 +2698,8 @@ class GanttBarDrag {
2607
2698
  this.item = item;
2608
2699
  this.barElement = elementRef.nativeElement;
2609
2700
  this.ganttUpper = ganttUpper;
2610
- if (!item.draggable || (this.dragDisabled && this.linkDragDisabled)) {
2701
+ // if (!item.draggable || (this.dragDisabled && this.linkDragDisabled)) {
2702
+ if (this.dragDisabled && this.linkDragDisabled) {
2611
2703
  return;
2612
2704
  }
2613
2705
  else {
@@ -2630,27 +2722,30 @@ class GanttBarDrag {
2630
2722
  this.destroy$.complete();
2631
2723
  }
2632
2724
  }
2633
- 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 });
2634
- GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttBarDrag });
2635
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttBarDrag, decorators: [{
2725
+ 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 });
2726
+ GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttBarDrag });
2727
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttBarDrag, decorators: [{
2636
2728
  type: Injectable
2637
- }], ctorParameters: function () { return [{ type: i1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }]; } });
2729
+ }], ctorParameters: function () { return [{ type: i1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: NgxGanttRootComponent, decorators: [{
2730
+ type: SkipSelf
2731
+ }] }]; } });
2638
2732
 
2639
2733
  function linearGradient(sideOrCorner, color, stop) {
2640
2734
  return `linear-gradient(${sideOrCorner},${color} 0%,${stop} 40%)`;
2641
2735
  }
2642
2736
  class NgxGanttBarComponent extends GanttItemUpper {
2643
- constructor(dragContainer, drag, elementRef, ganttUpper) {
2737
+ constructor(dragContainer, drag, elementRef, ganttUpper, ngZone) {
2644
2738
  super(elementRef, ganttUpper);
2645
2739
  this.dragContainer = dragContainer;
2646
2740
  this.drag = drag;
2647
2741
  this.ganttUpper = ganttUpper;
2742
+ this.ngZone = ngZone;
2648
2743
  this.barClick = new EventEmitter();
2649
2744
  this.ganttItemClass = true;
2650
2745
  this.color = 'red';
2651
2746
  }
2652
2747
  ngOnInit() {
2653
- super.onInit();
2748
+ super.ngOnInit();
2654
2749
  this.dragContainer.dragEnded.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2655
2750
  this.setContentBackground();
2656
2751
  });
@@ -2658,9 +2753,14 @@ class NgxGanttBarComponent extends GanttItemUpper {
2658
2753
  ngAfterViewInit() {
2659
2754
  this.drag.createDrags(this.elementRef, this.item, this.ganttUpper);
2660
2755
  this.setContentBackground();
2661
- }
2662
- ngOnChanges() {
2663
- super.onChanges();
2756
+ this.handles.changes
2757
+ .pipe(startWith(this.handles), switchMap(() =>
2758
+ // Note: we need to explicitly subscribe outside of the Angular zone since `addEventListener`
2759
+ // is called when the `fromEvent` is subscribed.
2760
+ new Observable((subscriber) => this.ngZone.runOutsideAngular(() => merge(...this.handles.toArray().map((handle) => fromEvent(handle.nativeElement, 'mousedown'))).subscribe(subscriber)))), takeUntil(this.unsubscribe$))
2761
+ .subscribe((event) => {
2762
+ event.stopPropagation();
2763
+ });
2664
2764
  }
2665
2765
  onBarClick(event) {
2666
2766
  this.barClick.emit({ event, item: this.item.origin });
@@ -2696,13 +2796,10 @@ class NgxGanttBarComponent extends GanttItemUpper {
2696
2796
  stopPropagation(event) {
2697
2797
  event.stopPropagation();
2698
2798
  }
2699
- ngOnDestroy() {
2700
- super.onDestroy();
2701
- }
2702
2799
  }
2703
- 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 });
2704
- 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"] }] });
2705
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
2800
+ 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 });
2801
+ 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 class=\"drag-handles\">\n <ng-container *ngIf=\"item.draggable && ganttUpper.draggable\">\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"] }] });
2802
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
2706
2803
  type: Component,
2707
2804
  args: [{
2708
2805
  selector: 'ngx-gantt-bar,gantt-bar',
@@ -2712,7 +2809,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2712
2809
  }], ctorParameters: function () { return [{ type: GanttDragContainer }, { type: GanttBarDrag }, { type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2713
2810
  type: Inject,
2714
2811
  args: [GANTT_UPPER_TOKEN]
2715
- }] }]; }, propDecorators: { barClick: [{
2812
+ }] }, { type: i0.NgZone }]; }, propDecorators: { barClick: [{
2716
2813
  type: Output
2717
2814
  }], contentElementRef: [{
2718
2815
  type: ViewChild,
@@ -2720,6 +2817,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2720
2817
  }], ganttItemClass: [{
2721
2818
  type: HostBinding,
2722
2819
  args: ['class.gantt-bar']
2820
+ }], handles: [{
2821
+ type: ViewChildren,
2822
+ args: ['handle']
2723
2823
  }] } });
2724
2824
 
2725
2825
  class GanttMainComponent {
@@ -2729,14 +2829,13 @@ class GanttMainComponent {
2729
2829
  this.lineClick = new EventEmitter();
2730
2830
  this.ganttMainClass = true;
2731
2831
  }
2732
- ngOnInit() { }
2733
2832
  trackBy(index, item) {
2734
2833
  return item.id || index;
2735
2834
  }
2736
2835
  }
2737
- 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 });
2738
- 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 } });
2739
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttMainComponent, decorators: [{
2836
+ 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 });
2837
+ 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 } });
2838
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: GanttMainComponent, decorators: [{
2740
2839
  type: Component,
2741
2840
  args: [{
2742
2841
  selector: 'gantt-main',
@@ -2778,13 +2877,20 @@ class NgxGanttComponent extends GanttUpper {
2778
2877
  this.sideTableWidth = sideWidth;
2779
2878
  }
2780
2879
  ngOnInit() {
2781
- super.onInit();
2782
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
2783
- this.dragContainer.linkDragStarted.pipe(takeUntil(this.ngUnsubscribe$)).subscribe((event) => {
2784
- this.linkDragStarted.emit(event);
2785
- });
2786
- this.dragContainer.linkDragEnded.pipe(takeUntil(this.ngUnsubscribe$)).subscribe((event) => {
2787
- this.linkDragEnded.emit(event);
2880
+ super.ngOnInit();
2881
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
2882
+ // the `onStable` will never emit any value.
2883
+ const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
2884
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
2885
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
2886
+ this.ngZone.runOutsideAngular(() => {
2887
+ onStable$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2888
+ this.dragContainer.linkDragStarted.pipe(takeUntil(this.ngUnsubscribe$)).subscribe((event) => {
2889
+ this.linkDragStarted.emit(event);
2890
+ });
2891
+ this.dragContainer.linkDragEnded.pipe(takeUntil(this.ngUnsubscribe$)).subscribe((event) => {
2892
+ this.linkDragEnded.emit(event);
2893
+ });
2788
2894
  });
2789
2895
  });
2790
2896
  }
@@ -2798,9 +2904,6 @@ class NgxGanttComponent extends GanttUpper {
2798
2904
  this.cdr.detectChanges();
2799
2905
  });
2800
2906
  }
2801
- ngOnChanges(changes) {
2802
- super.onChanges(changes);
2803
- }
2804
2907
  expandChildren(item) {
2805
2908
  if (!item.expanded) {
2806
2909
  item.setExpand(true);
@@ -2844,12 +2947,9 @@ class NgxGanttComponent extends GanttUpper {
2844
2947
  this.selectedChange.emit({ event, selectedValue: _selectedValue });
2845
2948
  }
2846
2949
  }
2847
- ngOnDestroy() {
2848
- super.onDestroy();
2849
- }
2850
2950
  }
2851
- 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 });
2852
- NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick", selectedChange: "selectedChange" }, providers: [
2951
+ 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 });
2952
+ 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: [
2853
2953
  {
2854
2954
  provide: GANTT_UPPER_TOKEN,
2855
2955
  useExisting: NgxGanttComponent
@@ -2858,8 +2958,8 @@ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
2858
2958
  provide: GANTT_ABSTRACT_TOKEN,
2859
2959
  useExisting: forwardRef(() => NgxGanttComponent)
2860
2960
  }
2861
- ], 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 });
2862
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttComponent, decorators: [{
2961
+ ], 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 });
2962
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttComponent, decorators: [{
2863
2963
  type: Component,
2864
2964
  args: [{
2865
2965
  selector: 'ngx-gantt',
@@ -2908,8 +3008,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2908
3008
 
2909
3009
  class NgxGanttModule {
2910
3010
  }
2911
- NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2912
- NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
3011
+ NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3012
+ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
2913
3013
  NgxGanttTableComponent,
2914
3014
  NgxGanttTableColumnComponent,
2915
3015
  GanttTableComponent,
@@ -2929,13 +3029,13 @@ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version:
2929
3029
  NgxGanttRootComponent,
2930
3030
  NgxGanttBarComponent,
2931
3031
  NgxGanttRangeComponent] });
2932
- NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, providers: [
3032
+ NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttModule, providers: [
2933
3033
  {
2934
3034
  provide: GANTT_GLOBAL_CONFIG,
2935
3035
  useValue: defaultConfig
2936
3036
  }
2937
3037
  ], imports: [[CommonModule, DragDropModule]] });
2938
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, decorators: [{
3038
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0, type: NgxGanttModule, decorators: [{
2939
3039
  type: NgModule,
2940
3040
  args: [{
2941
3041
  imports: [CommonModule, DragDropModule],