@worktile/gantt 12.2.1 → 12.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/bundles/worktile-gantt.umd.js +305 -210
  2. package/bundles/worktile-gantt.umd.js.map +1 -1
  3. package/components/bar/bar-drag.d.ts +4 -2
  4. package/components/bar/bar.component.d.ts +4 -4
  5. package/components/calendar/calendar.component.d.ts +3 -5
  6. package/components/drag-backdrop/drag-backdrop.component.d.ts +1 -5
  7. package/components/icon/icon.component.d.ts +2 -4
  8. package/components/main/gantt-main.component.d.ts +2 -3
  9. package/components/range/range.component.d.ts +2 -5
  10. package/components/table/gantt-table.component.d.ts +2 -3
  11. package/esm2015/components/bar/bar-drag.js +24 -17
  12. package/esm2015/components/bar/bar.component.js +21 -14
  13. package/esm2015/components/calendar/calendar.component.js +16 -11
  14. package/esm2015/components/drag-backdrop/drag-backdrop.component.js +8 -12
  15. package/esm2015/components/icon/icon.component.js +1 -3
  16. package/esm2015/components/links/links.component.js +2 -2
  17. package/esm2015/components/main/gantt-main.component.js +1 -2
  18. package/esm2015/components/range/range.component.js +2 -11
  19. package/esm2015/components/table/gantt-table.component.js +7 -3
  20. package/esm2015/gantt-dom.service.js +39 -25
  21. package/esm2015/gantt-item-upper.js +5 -5
  22. package/esm2015/gantt-print.service.js +50 -47
  23. package/esm2015/gantt-upper.js +27 -18
  24. package/esm2015/gantt.component.js +17 -16
  25. package/esm2015/root.component.js +41 -29
  26. package/esm2015/table/gantt-column.component.js +1 -2
  27. package/esm2015/table/gantt-table.component.js +2 -3
  28. package/esm2015/utils/passive-listeners.js +30 -0
  29. package/esm2015/utils/set-style-with-vendor-prefix.js +15 -0
  30. package/esm2015/views/day.js +1 -1
  31. package/fesm2015/worktile-gantt.js +285 -205
  32. package/fesm2015/worktile-gantt.js.map +1 -1
  33. package/gantt-dom.service.d.ts +11 -4
  34. package/gantt-item-upper.d.ts +5 -5
  35. package/gantt-print.service.d.ts +1 -1
  36. package/gantt-upper.d.ts +5 -5
  37. package/gantt.component.d.ts +2 -4
  38. package/main.bundle.scss +3 -2
  39. package/package.json +1 -1
  40. package/root.component.d.ts +5 -3
  41. package/table/gantt-column.component.d.ts +2 -3
  42. package/table/gantt-table.component.d.ts +2 -4
  43. package/utils/passive-listeners.d.ts +13 -0
  44. package/utils/set-style-with-vendor-prefix.d.ts +12 -0
  45. package/README.md +0 -24
@@ -1,10 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('rxjs/operators'), require('rxjs'), require('date-fns'), require('@angular/cdk/collections'), require('@angular/cdk/coercion'), require('@angular/cdk/drag-drop'), require('html2canvas')) :
3
- typeof define === 'function' && define.amd ? define('@worktile/gantt', ['exports', '@angular/core', '@angular/common', 'rxjs/operators', 'rxjs', 'date-fns', '@angular/cdk/collections', '@angular/cdk/coercion', '@angular/cdk/drag-drop', 'html2canvas'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.worktile = global.worktile || {}, global.worktile.gantt = {}), global.ng.core, global.ng.common, global.rxjs.operators, global.rxjs, global.dateFns, global.ng.cdk.collections, global.ng.cdk.coercion, global.ng.cdk.dragDrop, global.html2canvas));
5
- })(this, (function (exports, i0, i2, operators, rxjs, dateFns, collections, coercion, i1, html2canvas) { 'use strict';
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('rxjs/operators'), require('rxjs'), require('date-fns'), require('@angular/cdk/collections'), require('@angular/cdk/coercion'), require('@angular/cdk/drag-drop')) :
3
+ typeof define === 'function' && define.amd ? define('@worktile/gantt', ['exports', '@angular/core', '@angular/common', 'rxjs/operators', 'rxjs', 'date-fns', '@angular/cdk/collections', '@angular/cdk/coercion', '@angular/cdk/drag-drop'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.worktile = global.worktile || {}, global.worktile.gantt = {}), global.ng.core, global.ng.common, global.rxjs.operators, global.rxjs, global.dateFns, global.ng.cdk.collections, global.ng.cdk.coercion, global.ng.cdk.dragDrop));
5
+ })(this, (function (exports, i0, i2, operators, rxjs, dateFns, collections, coercion, i1) { 'use strict';
8
6
 
9
7
  function _interopNamespace(e) {
10
8
  if (e && e.__esModule) return e;
@@ -27,7 +25,6 @@
27
25
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
26
  var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
29
27
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
30
- var html2canvas__default = /*#__PURE__*/_interopDefaultLegacy(html2canvas);
31
28
 
32
29
  /*! *****************************************************************************
33
30
  Copyright (c) Microsoft Corporation.
@@ -1178,7 +1175,9 @@
1178
1175
  this.cdr = cdr;
1179
1176
  this.ngZone = ngZone;
1180
1177
  this.config = config;
1178
+ // eslint-disable-next-line @angular-eslint/no-input-rename
1181
1179
  this.originItems = [];
1180
+ // eslint-disable-next-line @angular-eslint/no-input-rename
1182
1181
  this.originGroups = [];
1183
1182
  this.viewType = exports.GanttViewType.month;
1184
1183
  this.showTodayLine = true;
@@ -1347,7 +1346,7 @@
1347
1346
  GanttUpper.prototype.initSelectionModel = function () {
1348
1347
  return new collections.SelectionModel(this.multiple, []);
1349
1348
  };
1350
- GanttUpper.prototype.onInit = function () {
1349
+ GanttUpper.prototype.ngOnInit = function () {
1351
1350
  var _this = this;
1352
1351
  this.styles = Object.assign({}, defaultStyles, this.styles);
1353
1352
  this.viewOptions.dateFormat = Object.assign({}, defaultConfig.dateFormat, this.config.dateFormat, this.viewOptions.dateFormat);
@@ -1357,25 +1356,32 @@
1357
1356
  this.computeRefs();
1358
1357
  this.initSelectionModel();
1359
1358
  this.firstChange = false;
1360
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
1361
- _this.element.style.opacity = '1';
1362
- _this.dragContainer.dragStarted.subscribe(function (event) {
1363
- _this.dragStarted.emit(event);
1364
- });
1365
- _this.dragContainer.dragMoved.subscribe(function (event) {
1366
- _this.dragMoved.emit(event);
1367
- });
1368
- _this.dragContainer.dragEnded.subscribe(function (event) {
1369
- _this.dragEnded.emit(event);
1370
- _this.computeRefs();
1371
- _this.detectChanges();
1359
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
1360
+ // the `onStable` will never emit any value.
1361
+ var onStable$ = this.ngZone.isStable ? rxjs.from(Promise.resolve()) : this.ngZone.onStable.pipe(operators.take(1));
1362
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
1363
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
1364
+ this.ngZone.runOutsideAngular(function () {
1365
+ onStable$.pipe(operators.takeUntil(_this.unsubscribe$)).subscribe(function () {
1366
+ _this.element.style.opacity = '1';
1367
+ _this.dragContainer.dragStarted.pipe(operators.takeUntil(_this.unsubscribe$)).subscribe(function (event) {
1368
+ _this.dragStarted.emit(event);
1369
+ });
1370
+ _this.dragContainer.dragMoved.pipe(operators.takeUntil(_this.unsubscribe$)).subscribe(function (event) {
1371
+ _this.dragMoved.emit(event);
1372
+ });
1373
+ _this.dragContainer.dragEnded.pipe(operators.takeUntil(_this.unsubscribe$)).subscribe(function (event) {
1374
+ _this.dragEnded.emit(event);
1375
+ _this.computeRefs();
1376
+ _this.detectChanges();
1377
+ });
1372
1378
  });
1373
1379
  });
1374
1380
  this.view.start$.pipe(operators.skip(1), operators.takeUntil(this.unsubscribe$)).subscribe(function () {
1375
1381
  _this.computeRefs();
1376
1382
  });
1377
1383
  };
1378
- GanttUpper.prototype.onChanges = function (changes) {
1384
+ GanttUpper.prototype.ngOnChanges = function (changes) {
1379
1385
  if (!this.firstChange) {
1380
1386
  if (changes.viewType && changes.viewType.currentValue) {
1381
1387
  this.createView();
@@ -1392,7 +1398,7 @@
1392
1398
  }
1393
1399
  }
1394
1400
  };
1395
- GanttUpper.prototype.onDestroy = function () {
1401
+ GanttUpper.prototype.ngOnDestroy = function () {
1396
1402
  this.unsubscribe$.next();
1397
1403
  this.unsubscribe$.complete();
1398
1404
  };
@@ -1453,7 +1459,7 @@
1453
1459
  return GanttUpper;
1454
1460
  }());
1455
1461
  GanttUpper.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttUpper, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1456
- GanttUpper.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.5", type: GanttUpper, inputs: { originItems: ["items", "originItems"], originGroups: ["groups", "originGroups"], viewType: "viewType", start: "start", end: "end", showTodayLine: "showTodayLine", draggable: "draggable", styles: "styles", viewOptions: "viewOptions", linkOptions: "linkOptions", disabledLoadOnScroll: "disabledLoadOnScroll", selectable: "selectable", multiple: "multiple" }, outputs: { loadOnScroll: "loadOnScroll", dragStarted: "dragStarted", dragMoved: "dragMoved", dragEnded: "dragEnded", barClick: "barClick" }, host: { properties: { "class.gantt": "this.ganttClass" } }, queries: [{ propertyName: "barTemplate", first: true, predicate: ["bar"], descendants: true, static: true }, { propertyName: "rangeTemplate", first: true, predicate: ["range"], descendants: true, static: true }, { propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, static: true }, { propertyName: "groupTemplate", first: true, predicate: ["group"], descendants: true, static: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ["groupHeader"], descendants: true, static: true }], ngImport: i0__namespace });
1462
+ GanttUpper.ɵdir = i0__namespace.ɵɵ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__namespace });
1457
1463
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttUpper, decorators: [{
1458
1464
  type: i0.Directive
1459
1465
  }], ctorParameters: function () {
@@ -1531,7 +1537,6 @@
1531
1537
  enumerable: false,
1532
1538
  configurable: true
1533
1539
  });
1534
- NgxGanttTableColumnComponent.prototype.ngOnInit = function () { };
1535
1540
  return NgxGanttTableColumnComponent;
1536
1541
  }());
1537
1542
  NgxGanttTableColumnComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NgxGanttTableColumnComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Component });
@@ -1563,7 +1568,6 @@
1563
1568
  function NgxGanttTableComponent() {
1564
1569
  this.columnChanges = new i0.EventEmitter();
1565
1570
  }
1566
- NgxGanttTableComponent.prototype.ngOnInit = function () { };
1567
1571
  return NgxGanttTableComponent;
1568
1572
  }());
1569
1573
  NgxGanttTableComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NgxGanttTableComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
@@ -1574,7 +1578,7 @@
1574
1578
  selector: 'ngx-gantt-table',
1575
1579
  template: ''
1576
1580
  }]
1577
- }], ctorParameters: function () { return []; }, propDecorators: { columnChanges: [{
1581
+ }], propDecorators: { columnChanges: [{
1578
1582
  type: i0.Output
1579
1583
  }], rowBeforeTemplate: [{
1580
1584
  type: i0.ContentChild,
@@ -1586,6 +1590,22 @@
1586
1590
 
1587
1591
  var GANTT_ABSTRACT_TOKEN = new i0.InjectionToken('gantt-abstract-token');
1588
1592
 
1593
+ var supports = (typeof window !== 'undefined' && !!window.CSS && CSS.supports) || (function () { return false; });
1594
+ /**
1595
+ * Note: we don't need to add vendor prefixes within `.scss` files since they're added automatically.
1596
+ * This function is necessary when the `element.style` is updated directly through the JavaScript.
1597
+ * This is not required to be used with CSS properties that don't require vendor prefixes (e.g. `opacity`).
1598
+ */
1599
+ function setStyleWithVendorPrefix(_a) {
1600
+ var element = _a.element, style = _a.style, value = _a.value;
1601
+ element.style[style] = value;
1602
+ if (supports("-webkit-" + style + ": " + value)) {
1603
+ // Note: some browsers still require setting `-webkit` vendor prefix. E.g. Mozilla 49 has implemented
1604
+ // the 3D support for `transform`, but it requires setting `-webkit-` prefix.
1605
+ element.style["-webkit-" + style] = value;
1606
+ }
1607
+ }
1608
+
1589
1609
  var angleRight = "<svg xmlns=\"http://www.w3.org/2000/svg\" fit=\"\" preserveAspectRatio=\"xMidYMid meet\" focusable=\"false\"><g id=\"amnavigation/angle-right\" stroke-width=\"1\" fill-rule=\"evenodd\"><path d=\"M7.978 11.498l-.005.005L2.3 5.831 3.13 5l4.848 4.848L12.826 5l.83.831-5.673 5.672-.005-.005z\" transform=\"rotate(-90 7.978 8.252)\"></path></g></svg>";
1590
1610
  var angleDown = "<svg xmlns=\"http://www.w3.org/2000/svg\" fit=\"\" preserveAspectRatio=\"xMidYMid meet\" focusable=\"false\"><g id=\"aknavigation/angle-down\" stroke-width=\"1\" fill-rule=\"evenodd\"><path d=\"M7.978 11.997l-.005.006L2.3 6.33l.83-.831 4.848 4.848L12.826 5.5l.83.83-5.673 5.673-.005-.006z\" ></path></g></svg>";
1591
1611
  var plusSquare = "<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\" fit=\"\" preserveAspectRatio=\"xMidYMid meet\" focusable=\"false\"><g id=\"kxaction/plus-square\" stroke-width=\"1\" fill-rule=\"evenodd\"><path d=\"M2 0h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2zm0 1.2a.8.8 0 0 0-.8.8v12a.8.8 0 0 0 .8.8h12a.8.8 0 0 0 .8-.8V2a.8.8 0 0 0-.8-.8H2zm5.45 6.2V4.75h1.2V7.4h2.65v1.2H8.65v2.65h-1.2V8.6H4.8V7.4h2.65z\"></path></g></svg>";
@@ -1613,8 +1633,6 @@
1613
1633
  enumerable: false,
1614
1634
  configurable: true
1615
1635
  });
1616
- GanttIconComponent.prototype.ngOnInit = function () { };
1617
- GanttIconComponent.prototype.ngAfterViewInit = function () { };
1618
1636
  GanttIconComponent.prototype.setSvg = function (name) {
1619
1637
  var iconSvg = icons[name];
1620
1638
  if (iconSvg) {
@@ -1713,7 +1731,6 @@
1713
1731
  enumerable: false,
1714
1732
  configurable: true
1715
1733
  });
1716
- GanttTableComponent.prototype.ngOnInit = function () { };
1717
1734
  GanttTableComponent.prototype.ngOnChanges = function (changes) {
1718
1735
  var _a, _b;
1719
1736
  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)) {
@@ -1725,7 +1742,11 @@
1725
1742
  };
1726
1743
  GanttTableComponent.prototype.dragFixed = function (config) {
1727
1744
  if (config.movedWidth < config.minWidth) {
1728
- config.target.style.transform = "translate3d(" + (config.minWidth - config.originWidth) + "px, 0, 0)";
1745
+ setStyleWithVendorPrefix({
1746
+ element: config.target,
1747
+ style: 'transform',
1748
+ value: "translate3d(" + (config.minWidth - config.originWidth) + "px, 0, 0)"
1749
+ });
1729
1750
  }
1730
1751
  };
1731
1752
  GanttTableComponent.prototype.expandGroup = function (group) {
@@ -1850,6 +1871,36 @@
1850
1871
  args: ['class.gantt-table-empty']
1851
1872
  }] } });
1852
1873
 
1874
+ /** Cached result of whether the user's browser supports passive event listeners. */
1875
+ var supportsPassiveEvents;
1876
+ /**
1877
+ * Checks whether the user's browser supports passive event listeners.
1878
+ * See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
1879
+ */
1880
+ function supportsPassiveEventListeners() {
1881
+ if (supportsPassiveEvents == null && typeof window !== 'undefined') {
1882
+ try {
1883
+ window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
1884
+ get: function () { return (supportsPassiveEvents = true); }
1885
+ }));
1886
+ }
1887
+ finally {
1888
+ supportsPassiveEvents = supportsPassiveEvents || false;
1889
+ }
1890
+ }
1891
+ return supportsPassiveEvents;
1892
+ }
1893
+ /**
1894
+ * Normalizes an `AddEventListener` object to something that can be passed
1895
+ * to `addEventListener` on any browser, no matter whether it supports the
1896
+ * `options` parameter.
1897
+ */
1898
+ function normalizePassiveListenerOptions(options) {
1899
+ return supportsPassiveEventListeners() ? options : !!options.capture;
1900
+ }
1901
+ /** Options used to bind passive event listeners. */
1902
+ var passiveListenerOptions = normalizePassiveListenerOptions({ passive: true });
1903
+
1853
1904
  var scrollThreshold = 50;
1854
1905
  var ScrollDirection;
1855
1906
  (function (ScrollDirection) {
@@ -1858,25 +1909,27 @@
1858
1909
  ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1859
1910
  })(ScrollDirection || (ScrollDirection = {}));
1860
1911
  var GanttDomService = /** @class */ (function () {
1861
- function GanttDomService() {
1912
+ function GanttDomService(ngZone, platformId) {
1913
+ this.ngZone = ngZone;
1914
+ this.platformId = platformId;
1862
1915
  this.unsubscribe$ = new rxjs.Subject();
1863
1916
  }
1864
1917
  GanttDomService.prototype.monitorScrollChange = function () {
1865
1918
  var _this = this;
1866
- rxjs.merge(rxjs.fromEvent(this.mainContainer, 'scroll'), rxjs.fromEvent(this.sideContainer, 'scroll'))
1867
- .pipe(operators.takeUntil(this.unsubscribe$))
1919
+ this.ngZone.runOutsideAngular(function () { return rxjs.merge(rxjs.fromEvent(_this.mainContainer, 'scroll', passiveListenerOptions), rxjs.fromEvent(_this.sideContainer, 'scroll', passiveListenerOptions))
1920
+ .pipe(operators.takeUntil(_this.unsubscribe$))
1868
1921
  .subscribe(function (event) {
1869
1922
  _this.syncScroll(event);
1870
- });
1871
- rxjs.fromEvent(this.mainContainer, 'scroll')
1872
- .pipe(operators.startWith(), operators.takeUntil(this.unsubscribe$))
1873
- .subscribe(function (event) {
1874
- // if (this.mainContainer.scrollLeft > 0) {
1875
- // this.side.classList.add('gantt-side-has-shadow');
1876
- // } else {
1877
- // this.side.classList.remove('gantt-side-has-shadow');
1878
- // }
1879
- });
1923
+ }); });
1924
+ // fromEvent(this.mainContainer, 'scroll')
1925
+ // .pipe(startWith(), takeUntil(this.unsubscribe$))
1926
+ // .subscribe((event) => {
1927
+ // // if (this.mainContainer.scrollLeft > 0) {
1928
+ // // this.side.classList.add('gantt-side-has-shadow');
1929
+ // // } else {
1930
+ // // this.side.classList.remove('gantt-side-has-shadow');
1931
+ // // }
1932
+ // });
1880
1933
  };
1881
1934
  GanttDomService.prototype.syncScroll = function (event) {
1882
1935
  var target = event.currentTarget;
@@ -1885,9 +1938,10 @@
1885
1938
  this.mainContainer.scrollTop = target.scrollTop;
1886
1939
  };
1887
1940
  GanttDomService.prototype.disableBrowserWheelEvent = function () {
1941
+ var _this = this;
1888
1942
  var container = this.mainContainer;
1889
- rxjs.fromEvent(container, 'wheel')
1890
- .pipe(operators.takeUntil(this.unsubscribe$))
1943
+ this.ngZone.runOutsideAngular(function () { return rxjs.fromEvent(container, 'wheel')
1944
+ .pipe(operators.takeUntil(_this.unsubscribe$))
1891
1945
  .subscribe(function (event) {
1892
1946
  var delta = event.deltaX;
1893
1947
  if (!delta) {
@@ -1897,7 +1951,7 @@
1897
1951
  (container.scrollLeft === 0 && delta < 0)) {
1898
1952
  event.preventDefault();
1899
1953
  }
1900
- });
1954
+ }); });
1901
1955
  };
1902
1956
  GanttDomService.prototype.initialize = function (root) {
1903
1957
  this.root = root.nativeElement;
@@ -1909,9 +1963,14 @@
1909
1963
  this.monitorScrollChange();
1910
1964
  this.disableBrowserWheelEvent();
1911
1965
  };
1912
- GanttDomService.prototype.getViewerScroll = function () {
1966
+ /**
1967
+ * @returns An observable that will emit outside the Angular zone. Note, consumers should re-enter the Angular zone
1968
+ * to run the change detection if needed.
1969
+ */
1970
+ GanttDomService.prototype.getViewerScroll = function (options) {
1913
1971
  var _this = this;
1914
- return rxjs.fromEvent(this.mainContainer, 'scroll').pipe(operators.map(function () { return _this.mainContainer.scrollLeft; }), operators.pairwise(), operators.map(function (_a) {
1972
+ return new rxjs.Observable(function (subscriber) { return _this.ngZone.runOutsideAngular(function () { return rxjs.fromEvent(_this.mainContainer, 'scroll', options)
1973
+ .pipe(operators.map(function () { return _this.mainContainer.scrollLeft; }), operators.pairwise(), operators.map(function (_a) {
1915
1974
  var _b = __read(_a, 2), previous = _b[0], current = _b[1];
1916
1975
  var event = {
1917
1976
  target: _this.mainContainer,
@@ -1923,15 +1982,17 @@
1923
1982
  }
1924
1983
  }
1925
1984
  if (current - previous > 0) {
1926
- if (_this.mainContainer.scrollWidth - _this.mainContainer.clientWidth - _this.mainContainer.scrollLeft < scrollThreshold) {
1985
+ if (_this.mainContainer.scrollWidth - _this.mainContainer.clientWidth - _this.mainContainer.scrollLeft <
1986
+ scrollThreshold) {
1927
1987
  event.direction = ScrollDirection.RIGHT;
1928
1988
  }
1929
1989
  }
1930
1990
  return event;
1931
- }));
1991
+ }))
1992
+ .subscribe(subscriber); }); });
1932
1993
  };
1933
1994
  GanttDomService.prototype.getResize = function () {
1934
- return rxjs.fromEvent(window, 'resize').pipe(operators.auditTime(150));
1995
+ return i2.isPlatformServer(this.platformId) ? rxjs.EMPTY : rxjs.fromEvent(window, 'resize').pipe(operators.auditTime(150));
1935
1996
  };
1936
1997
  GanttDomService.prototype.scrollMainContainer = function (left) {
1937
1998
  if (isNumber(left)) {
@@ -1946,11 +2007,16 @@
1946
2007
  };
1947
2008
  return GanttDomService;
1948
2009
  }());
1949
- GanttDomService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttDomService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2010
+ GanttDomService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttDomService, deps: [{ token: i0__namespace.NgZone }, { token: i0.PLATFORM_ID }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1950
2011
  GanttDomService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttDomService });
1951
2012
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttDomService, decorators: [{
1952
2013
  type: i0.Injectable
1953
- }], ctorParameters: function () { return []; } });
2014
+ }], ctorParameters: function () {
2015
+ return [{ type: i0__namespace.NgZone }, { type: undefined, decorators: [{
2016
+ type: i0.Inject,
2017
+ args: [i0.PLATFORM_ID]
2018
+ }] }];
2019
+ } });
1954
2020
 
1955
2021
  function getDependencyType(path, dependencyTypes) {
1956
2022
  if (dependencyTypes.includes(exports.GanttLinkType.ss) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.start) {
@@ -2027,6 +2093,24 @@
2027
2093
  }] }];
2028
2094
  } });
2029
2095
 
2096
+ var GanttDragBackdropComponent = /** @class */ (function () {
2097
+ function GanttDragBackdropComponent() {
2098
+ }
2099
+ return GanttDragBackdropComponent;
2100
+ }());
2101
+ GanttDragBackdropComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttDragBackdropComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
2102
+ GanttDragBackdropComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop", host: { classAttribute: "gantt-drag-backdrop" }, ngImport: i0__namespace, template: "<div class=\"gantt-drag-mask\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n" });
2103
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttDragBackdropComponent, decorators: [{
2104
+ type: i0.Component,
2105
+ args: [{
2106
+ selector: 'gantt-drag-backdrop',
2107
+ templateUrl: "./drag-backdrop.component.html",
2108
+ host: {
2109
+ class: 'gantt-drag-backdrop'
2110
+ }
2111
+ }]
2112
+ }] });
2113
+
2030
2114
  var GanttPrintService = /** @class */ (function () {
2031
2115
  function GanttPrintService() {
2032
2116
  }
@@ -2096,54 +2180,64 @@
2096
2180
  this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
2097
2181
  };
2098
2182
  GanttPrintService.prototype.print = function (name, ignoreElementClass) {
2099
- var _this = this;
2100
2183
  if (name === void 0) { name = 'download'; }
2101
- var root = this.root;
2102
- var mainContainer = this.mainContainer;
2103
- // set print width
2104
- var printWidth = root.offsetWidth;
2105
- // set print height
2106
- var printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
2107
- html2canvas__default["default"](root, {
2108
- logging: false,
2109
- allowTaint: true,
2110
- useCORS: true,
2111
- width: printWidth,
2112
- height: printHeight,
2113
- ignoreElements: function (element) {
2114
- if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
2115
- return true;
2116
- }
2117
- if (element.classList.contains('gantt-calendar-today-overlay')) {
2118
- return true;
2119
- }
2120
- },
2121
- onclone: function (cloneDocument) {
2122
- var ganttClass = root.className;
2123
- var cloneGanttDom = cloneDocument.querySelector("." + ganttClass.replace(/\s+/g, '.'));
2124
- var cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
2125
- var cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
2126
- var cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
2127
- // change targetDom width
2128
- cloneGanttDom.style.width = printWidth + "px";
2129
- cloneGanttDom.style.height = printHeight + "px";
2130
- cloneGanttDom.style.overflow = "unset";
2131
- cloneGanttContainerDom.style.backgroundColor = '#fff';
2132
- cloneCalendarOverlay.setAttribute('height', "" + printHeight);
2133
- cloneCalendarOverlay.setAttribute('style', "background: transparent");
2134
- if (cloneLinksOverlay) {
2135
- cloneLinksOverlay.setAttribute('height', "" + printHeight);
2136
- cloneLinksOverlay.setAttribute('style', "height: " + printHeight + "px");
2184
+ return __awaiter(this, void 0, void 0, function () {
2185
+ var root, mainContainer, printWidth, printHeight, html2canvas;
2186
+ var _this = this;
2187
+ return __generator(this, function (_a) {
2188
+ switch (_a.label) {
2189
+ case 0:
2190
+ root = this.root;
2191
+ mainContainer = this.mainContainer;
2192
+ printWidth = root.offsetWidth;
2193
+ printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
2194
+ return [4 /*yield*/, import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')];
2195
+ case 1:
2196
+ html2canvas = (_a.sent()).default;
2197
+ html2canvas(root, {
2198
+ logging: false,
2199
+ allowTaint: true,
2200
+ useCORS: true,
2201
+ width: printWidth,
2202
+ height: printHeight,
2203
+ ignoreElements: function (element) {
2204
+ if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
2205
+ return true;
2206
+ }
2207
+ if (element.classList.contains('gantt-calendar-today-overlay')) {
2208
+ return true;
2209
+ }
2210
+ },
2211
+ onclone: function (cloneDocument) {
2212
+ var ganttClass = root.className;
2213
+ var cloneGanttDom = cloneDocument.querySelector("." + ganttClass.replace(/\s+/g, '.'));
2214
+ var cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
2215
+ var cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
2216
+ var cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
2217
+ // change targetDom width
2218
+ cloneGanttDom.style.width = printWidth + "px";
2219
+ cloneGanttDom.style.height = printHeight + "px";
2220
+ cloneGanttDom.style.overflow = "unset";
2221
+ cloneGanttContainerDom.style.backgroundColor = '#fff';
2222
+ cloneCalendarOverlay.setAttribute('height', "" + printHeight);
2223
+ cloneCalendarOverlay.setAttribute('style', "background: transparent");
2224
+ if (cloneLinksOverlay) {
2225
+ cloneLinksOverlay.setAttribute('height', "" + printHeight);
2226
+ cloneLinksOverlay.setAttribute('style', "height: " + printHeight + "px");
2227
+ }
2228
+ // setInlineStyles for svg
2229
+ _this.setInlineStyles(cloneGanttDom);
2230
+ }
2231
+ }).then(function (canvas) {
2232
+ var link = document.createElement('a');
2233
+ var dataUrl = canvas.toDataURL('image/png');
2234
+ link.download = name + ".png";
2235
+ link.href = dataUrl;
2236
+ link.click();
2237
+ });
2238
+ return [2 /*return*/];
2137
2239
  }
2138
- // setInlineStyles for svg
2139
- _this.setInlineStyles(cloneGanttDom);
2140
- }
2141
- }).then(function (canvas) {
2142
- var link = document.createElement('a');
2143
- var dataUrl = canvas.toDataURL('image/png');
2144
- link.download = name + ".png";
2145
- link.href = dataUrl;
2146
- link.click();
2240
+ });
2147
2241
  });
2148
2242
  };
2149
2243
  return GanttPrintService;
@@ -2160,7 +2254,6 @@
2160
2254
  this.ganttUpper = ganttUpper;
2161
2255
  this.ngZone = ngZone;
2162
2256
  this.elementRef = elementRef;
2163
- this.unsubscribe$ = new rxjs.Subject();
2164
2257
  this.headerHeight = headerHeight;
2165
2258
  this.mainHeight = mainHeight;
2166
2259
  this.todayHeight = todayHeight;
@@ -2168,6 +2261,7 @@
2168
2261
  this.todayBorderRadius = todayBorderRadius;
2169
2262
  this.viewTypes = exports.GanttViewType;
2170
2263
  this.className = true;
2264
+ this.unsubscribe$ = new rxjs.Subject();
2171
2265
  }
2172
2266
  Object.defineProperty(GanttCalendarComponent.prototype, "view", {
2173
2267
  get: function () {
@@ -2200,16 +2294,21 @@
2200
2294
  };
2201
2295
  GanttCalendarComponent.prototype.ngOnInit = function () {
2202
2296
  var _this = this;
2203
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
2204
- rxjs.merge(_this.ganttUpper.viewChange, _this.ganttUpper.view.start$)
2205
- .pipe(operators.takeUntil(_this.unsubscribe$))
2206
- .subscribe(function () {
2207
- _this.setTodayPoint();
2297
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
2298
+ // the `onStable` will never emit any value.
2299
+ var onStable$ = this.ngZone.isStable ? rxjs.from(Promise.resolve()) : this.ngZone.onStable.pipe(operators.take(1));
2300
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
2301
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
2302
+ this.ngZone.runOutsideAngular(function () {
2303
+ onStable$.pipe(operators.takeUntil(_this.unsubscribe$)).subscribe(function () {
2304
+ rxjs.merge(_this.ganttUpper.viewChange, _this.ganttUpper.view.start$)
2305
+ .pipe(operators.takeUntil(_this.unsubscribe$))
2306
+ .subscribe(function () {
2307
+ _this.setTodayPoint();
2308
+ });
2208
2309
  });
2209
2310
  });
2210
2311
  };
2211
- GanttCalendarComponent.prototype.ngAfterViewInit = function () { };
2212
- GanttCalendarComponent.prototype.ngOnChanges = function (changes) { };
2213
2312
  GanttCalendarComponent.prototype.trackBy = function (index, point) {
2214
2313
  return point.text || index;
2215
2314
  };
@@ -2220,7 +2319,7 @@
2220
2319
  return GanttCalendarComponent;
2221
2320
  }());
2222
2321
  GanttCalendarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttCalendarComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0__namespace.NgZone }, { token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
2223
- GanttCalendarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: GanttCalendarComponent, selector: "gantt-calendar-overlay", host: { properties: { "class.gantt-calendar-overlay": "this.className" } }, usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-overlay-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text class=\"primary-text\" *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text class=\"secondary-text\" [class.secondary-text-weekend]=\"point.additions?.isWeekend\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n </ng-container>\n\n <g>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n\n <g>\n <line [attr.x1]=\"0\" [attr.x2]=\"view.width\" [attr.y1]=\"headerHeight\" [attr.y2]=\"headerHeight\" class=\"header-line\"></line>\n </g>\n </g>\n <g>\n <g *ngIf=\"view.showTimeline\">\n <line\n *ngFor=\"let point of view.secondaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.cellWidth\"\n [attr.x2]=\"(i + 1) * view.cellWidth\"\n [attr.y1]=\"headerHeight\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n </g>\n</svg>\n", directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
2322
+ GanttCalendarComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-rect\" [hidden]=\"ganttUpper.viewType !== viewTypes.day\"> </span>\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-overlay-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight\">\n <g>\n <text class=\"primary-text\" *ngFor=\"let point of view.primaryDatePoints; trackBy: trackBy\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n <ng-container *ngFor=\"let point of view.secondaryDatePoints; trackBy: trackBy\">\n <text class=\"secondary-text\" [class.secondary-text-weekend]=\"point.additions?.isWeekend\" [attr.x]=\"point.x\" [attr.y]=\"point.y\">\n {{ point.text }}\n </text>\n </ng-container>\n\n <g>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n\n <g>\n <line [attr.x1]=\"0\" [attr.x2]=\"view.width\" [attr.y1]=\"headerHeight\" [attr.y2]=\"headerHeight\" class=\"header-line\"></line>\n </g>\n </g>\n <g>\n <g *ngIf=\"view.showTimeline\">\n <line\n *ngFor=\"let point of view.secondaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.cellWidth\"\n [attr.x2]=\"(i + 1) * view.cellWidth\"\n [attr.y1]=\"headerHeight\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n <line\n *ngFor=\"let point of view.primaryDatePoints; let i = index; trackBy: trackBy\"\n [attr.x1]=\"(i + 1) * view.primaryWidth\"\n [attr.x2]=\"(i + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n </g>\n </g>\n</svg>\n", directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
2224
2323
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttCalendarComponent, decorators: [{
2225
2324
  type: i0.Component,
2226
2325
  args: [{
@@ -2237,26 +2336,6 @@
2237
2336
  args: ['class.gantt-calendar-overlay']
2238
2337
  }] } });
2239
2338
 
2240
- var GanttDragBackdropComponent = /** @class */ (function () {
2241
- function GanttDragBackdropComponent() {
2242
- this.backdropClass = true;
2243
- }
2244
- GanttDragBackdropComponent.prototype.ngOnInit = function () { };
2245
- return GanttDragBackdropComponent;
2246
- }());
2247
- GanttDragBackdropComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttDragBackdropComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
2248
- GanttDragBackdropComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop", host: { properties: { "class.gantt-drag-backdrop": "this.backdropClass" } }, ngImport: i0__namespace, template: "<div class=\"gantt-drag-mask\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n" });
2249
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttDragBackdropComponent, decorators: [{
2250
- type: i0.Component,
2251
- args: [{
2252
- selector: 'gantt-drag-backdrop',
2253
- templateUrl: "./drag-backdrop.component.html"
2254
- }]
2255
- }], ctorParameters: function () { return []; }, propDecorators: { backdropClass: [{
2256
- type: i0.HostBinding,
2257
- args: ['class.gantt-drag-backdrop']
2258
- }] } });
2259
-
2260
2339
  var NgxGanttRootComponent = /** @class */ (function () {
2261
2340
  function NgxGanttRootComponent(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
2262
2341
  this.elementRef = elementRef;
@@ -2265,7 +2344,6 @@
2265
2344
  this.dragContainer = dragContainer;
2266
2345
  this.ganttUpper = ganttUpper;
2267
2346
  this.printService = printService;
2268
- this.ganttClass = true;
2269
2347
  this.unsubscribe$ = new rxjs.Subject();
2270
2348
  this.ganttUpper.dragContainer = dragContainer;
2271
2349
  }
@@ -2278,45 +2356,53 @@
2278
2356
  });
2279
2357
  NgxGanttRootComponent.prototype.ngOnInit = function () {
2280
2358
  var _this = this;
2281
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
2282
- _this.dom.initialize(_this.elementRef);
2283
- if (_this.printService) {
2284
- _this.printService.register(_this.elementRef);
2285
- }
2286
- _this.setupScrollClass();
2287
- _this.setupResize();
2288
- _this.setupViewScroll();
2289
- // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2290
- _this.elementRef.nativeElement.style.opacity = '1';
2291
- _this.ganttUpper.viewChange.pipe(operators.startWith(null)).subscribe(function () {
2292
- _this.scrollToToday();
2359
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
2360
+ // the `onStable` will never emit any value.
2361
+ var onStable$ = this.ngZone.isStable ? rxjs.from(Promise.resolve()) : this.ngZone.onStable.pipe(operators.take(1));
2362
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
2363
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
2364
+ this.ngZone.runOutsideAngular(function () {
2365
+ onStable$.pipe(operators.takeUntil(_this.unsubscribe$)).subscribe(function () {
2366
+ _this.dom.initialize(_this.elementRef);
2367
+ if (_this.printService) {
2368
+ _this.printService.register(_this.elementRef);
2369
+ }
2370
+ _this.setupScrollClass();
2371
+ _this.setupResize();
2372
+ _this.setupViewScroll();
2373
+ // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2374
+ _this.elementRef.nativeElement.style.opacity = '1';
2375
+ _this.ganttUpper.viewChange.pipe(operators.startWith(null), operators.takeUntil(_this.unsubscribe$)).subscribe(function () {
2376
+ _this.scrollToToday();
2377
+ });
2293
2378
  });
2294
2379
  });
2295
2380
  };
2381
+ NgxGanttRootComponent.prototype.ngOnDestroy = function () {
2382
+ this.unsubscribe$.next();
2383
+ };
2296
2384
  NgxGanttRootComponent.prototype.setupViewScroll = function () {
2297
2385
  var _this = this;
2298
2386
  if (this.ganttUpper.disabledLoadOnScroll) {
2299
2387
  return;
2300
2388
  }
2301
2389
  this.dom
2302
- .getViewerScroll()
2390
+ .getViewerScroll(passiveListenerOptions)
2303
2391
  .pipe(operators.takeUntil(this.unsubscribe$))
2304
2392
  .subscribe(function (event) {
2305
2393
  if (event.direction === ScrollDirection.LEFT) {
2306
2394
  var dates_1 = _this.view.addStartDate();
2307
2395
  if (dates_1) {
2308
2396
  event.target.scrollLeft += _this.view.getDateRangeWidth(dates_1.start, dates_1.end);
2309
- _this.ngZone.run(function () {
2310
- _this.ganttUpper.loadOnScroll.emit({ start: dates_1.start.getUnixTime(), end: dates_1.end.getUnixTime() });
2311
- });
2397
+ if (_this.ganttUpper.loadOnScroll.observers) {
2398
+ _this.ngZone.run(function () { return _this.ganttUpper.loadOnScroll.emit({ start: dates_1.start.getUnixTime(), end: dates_1.end.getUnixTime() }); });
2399
+ }
2312
2400
  }
2313
2401
  }
2314
2402
  if (event.direction === ScrollDirection.RIGHT) {
2315
2403
  var dates_2 = _this.view.addEndDate();
2316
- if (dates_2) {
2317
- _this.ngZone.run(function () {
2318
- _this.ganttUpper.loadOnScroll.emit({ start: dates_2.start.getUnixTime(), end: dates_2.end.getUnixTime() });
2319
- });
2404
+ if (dates_2 && _this.ganttUpper.loadOnScroll.observers) {
2405
+ _this.ngZone.run(function () { return _this.ganttUpper.loadOnScroll.emit({ start: dates_2.start.getUnixTime(), end: dates_2.end.getUnixTime() }); });
2320
2406
  }
2321
2407
  }
2322
2408
  });
@@ -2348,13 +2434,16 @@
2348
2434
  return NgxGanttRootComponent;
2349
2435
  }());
2350
2436
  NgxGanttRootComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NgxGanttRootComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.NgZone }, { token: GanttDomService }, { token: GanttDragContainer }, { token: GANTT_UPPER_TOKEN }, { token: GanttPrintService, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Component });
2351
- NgxGanttRootComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: { sideWidth: "sideWidth" }, host: { properties: { "class.gantt": "this.ganttClass" } }, providers: [GanttDomService, GanttDragContainer], queries: [{ propertyName: "sideTemplate", first: true, predicate: ["sideTemplate"], descendants: true, static: true }, { propertyName: "mainTemplate", first: true, predicate: ["mainTemplate"], descendants: true, static: true }], ngImport: i0__namespace, template: "<div class=\"gantt-side\" [style.width.px]=\"sideWidth\">\n <div class=\"gantt-side-container\">\n <ng-template [ngTemplateOutlet]=\"sideTemplate\"></ng-template>\n </div>\n</div>\n<div class=\"gantt-container\">\n <gantt-calendar-overlay></gantt-calendar-overlay>\n <gantt-drag-backdrop></gantt-drag-backdrop>\n <div class=\"gantt-main\">\n <ng-template [ngTemplateOutlet]=\"mainTemplate\"></ng-template>\n </div>\n</div>\n", components: [{ type: GanttCalendarComponent, selector: "gantt-calendar-overlay" }, { type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }], directives: [{ type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2437
+ NgxGanttRootComponent.ɵcmp = i0__namespace.ɵɵ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: i0.ElementRef, static: true }], ngImport: i0__namespace, template: "<div class=\"gantt-side\" [style.width.px]=\"sideWidth\">\n <div class=\"gantt-side-container\">\n <ng-template [ngTemplateOutlet]=\"sideTemplate\"></ng-template>\n </div>\n</div>\n<div class=\"gantt-container\">\n <gantt-calendar-overlay></gantt-calendar-overlay>\n <gantt-drag-backdrop></gantt-drag-backdrop>\n <div class=\"gantt-main\">\n <ng-template [ngTemplateOutlet]=\"mainTemplate\"></ng-template>\n </div>\n</div>\n", components: [{ type: GanttCalendarComponent, selector: "gantt-calendar-overlay" }, { type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }], directives: [{ type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2352
2438
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NgxGanttRootComponent, decorators: [{
2353
2439
  type: i0.Component,
2354
2440
  args: [{
2355
2441
  selector: 'ngx-gantt-root',
2356
2442
  templateUrl: './root.component.html',
2357
- providers: [GanttDomService, GanttDragContainer]
2443
+ providers: [GanttDomService, GanttDragContainer],
2444
+ host: {
2445
+ class: 'gantt'
2446
+ }
2358
2447
  }]
2359
2448
  }], ctorParameters: function () {
2360
2449
  return [{ type: i0__namespace.ElementRef }, { type: i0__namespace.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
@@ -2365,15 +2454,15 @@
2365
2454
  }] }];
2366
2455
  }, propDecorators: { sideWidth: [{
2367
2456
  type: i0.Input
2368
- }], ganttClass: [{
2369
- type: i0.HostBinding,
2370
- args: ['class.gantt']
2371
2457
  }], sideTemplate: [{
2372
2458
  type: i0.ContentChild,
2373
2459
  args: ['sideTemplate', { static: true }]
2374
2460
  }], mainTemplate: [{
2375
2461
  type: i0.ContentChild,
2376
2462
  args: ['mainTemplate', { static: true }]
2463
+ }], backdrop: [{
2464
+ type: i0.ViewChild,
2465
+ args: [GanttDragBackdropComponent, { static: true, read: i0.ElementRef }]
2377
2466
  }] } });
2378
2467
 
2379
2468
  var GanttLinkLine = /** @class */ (function () {
@@ -2562,7 +2651,7 @@
2562
2651
  _this.elementRef.nativeElement.style.visibility = 'hidden';
2563
2652
  });
2564
2653
  rxjs.merge(this.ganttUpper.viewChange, this.ganttUpper.expandChange, this.ganttUpper.view.start$, this.ganttUpper.dragEnded, this.ganttUpper.linkDragEnded)
2565
- .pipe(operators.takeUntil(this.unsubscribe$), operators.skip(1), operators.debounceTime(0))
2654
+ .pipe(operators.skip(1), operators.debounceTime(0), operators.takeUntil(this.unsubscribe$))
2566
2655
  .subscribe(function () {
2567
2656
  _this.elementRef.nativeElement.style.visibility = 'visible';
2568
2657
  _this.buildLinks();
@@ -2710,14 +2799,14 @@
2710
2799
  this.firstChange = true;
2711
2800
  this.unsubscribe$ = new rxjs.Subject();
2712
2801
  }
2713
- GanttItemUpper.prototype.onInit = function () {
2802
+ GanttItemUpper.prototype.ngOnInit = function () {
2714
2803
  var _this = this;
2715
2804
  this.firstChange = false;
2716
2805
  this.item.refs$.pipe(operators.takeUntil(this.unsubscribe$)).subscribe(function () {
2717
2806
  _this.setPositions();
2718
2807
  });
2719
2808
  };
2720
- GanttItemUpper.prototype.onChanges = function () {
2809
+ GanttItemUpper.prototype.ngOnChanges = function () {
2721
2810
  if (!this.firstChange) {
2722
2811
  this.setPositions();
2723
2812
  }
@@ -2736,14 +2825,14 @@
2736
2825
  else {
2737
2826
  }
2738
2827
  };
2739
- GanttItemUpper.prototype.onDestroy = function () {
2828
+ GanttItemUpper.prototype.ngOnDestroy = function () {
2740
2829
  this.unsubscribe$.next();
2741
2830
  this.unsubscribe$.complete();
2742
2831
  };
2743
2832
  return GanttItemUpper;
2744
2833
  }());
2745
2834
  GanttItemUpper.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttItemUpper, deps: [{ token: i0__namespace.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Directive });
2746
- GanttItemUpper.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.5", type: GanttItemUpper, inputs: { template: "template", item: "item" }, ngImport: i0__namespace });
2835
+ GanttItemUpper.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.5", type: GanttItemUpper, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0__namespace });
2747
2836
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttItemUpper, decorators: [{
2748
2837
  type: i0.Directive
2749
2838
  }], ctorParameters: function () {
@@ -2764,19 +2853,10 @@
2764
2853
  _this.ganttRangeClass = true;
2765
2854
  return _this;
2766
2855
  }
2767
- NgxGanttRangeComponent.prototype.ngOnInit = function () {
2768
- _super.prototype.onInit.call(this);
2769
- };
2770
- NgxGanttRangeComponent.prototype.ngOnChanges = function () {
2771
- _super.prototype.onChanges.call(this);
2772
- };
2773
- NgxGanttRangeComponent.prototype.ngOnDestroy = function () {
2774
- _super.prototype.onDestroy.call(this);
2775
- };
2776
2856
  return NgxGanttRangeComponent;
2777
2857
  }(GanttItemUpper));
2778
2858
  NgxGanttRangeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NgxGanttRangeComponent, deps: [{ token: i0__namespace.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Component });
2779
- NgxGanttRangeComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range", host: { properties: { "class.gantt-range": "this.ganttRangeClass" } }, usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<ng-container *ngIf=\"item.start && item.end\">\n <div class=\"gantt-range-main\">\n <div class=\"gantt-range-main-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n </div>\n <div class=\"gantt-range-triangle left\"></div>\n <div class=\"gantt-range-triangle right\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</ng-container>\n", directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2859
+ NgxGanttRangeComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, template: "<ng-container *ngIf=\"item.start && item.end\">\n <div class=\"gantt-range-main\">\n <div class=\"gantt-range-main-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n </div>\n <div class=\"gantt-range-triangle left\"></div>\n <div class=\"gantt-range-triangle right\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</ng-container>\n", directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2780
2860
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NgxGanttRangeComponent, decorators: [{
2781
2861
  type: i0.Component,
2782
2862
  args: [{
@@ -2803,10 +2883,11 @@
2803
2883
  return element;
2804
2884
  }
2805
2885
  var GanttBarDrag = /** @class */ (function () {
2806
- function GanttBarDrag(dragDrop, dom, dragContainer) {
2886
+ function GanttBarDrag(dragDrop, dom, dragContainer, root) {
2807
2887
  this.dragDrop = dragDrop;
2808
2888
  this.dom = dom;
2809
2889
  this.dragContainer = dragContainer;
2890
+ this.root = root;
2810
2891
  this.dragRefs = [];
2811
2892
  this.destroy$ = new rxjs.Subject();
2812
2893
  }
@@ -2831,9 +2912,9 @@
2831
2912
  ((_c = this.ganttUpper.config.linkOptions) === null || _c === void 0 ? void 0 : _c.dependencyTypes[0]) === exports.GanttLinkType.fs
2832
2913
  ? singleDropActiveClass
2833
2914
  : dropActiveClass;
2834
- rxjs.fromEvent(this.barElement, 'mouseenter')
2915
+ rxjs.fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
2835
2916
  .pipe(operators.takeUntil(this.destroy$))
2836
- .subscribe(function (event) {
2917
+ .subscribe(function () {
2837
2918
  if (_this.dragContainer.linkDraggingId && _this.dragContainer.linkDraggingId !== _this.item.id) {
2838
2919
  if (_this.item.linkable) {
2839
2920
  _this.barElement.classList.add(dropClass);
@@ -2847,9 +2928,9 @@
2847
2928
  _this.barElement.classList.add(activeClass);
2848
2929
  }
2849
2930
  });
2850
- rxjs.fromEvent(this.barElement, 'mouseleave')
2931
+ rxjs.fromEvent(this.barElement, 'mouseleave', passiveListenerOptions)
2851
2932
  .pipe(operators.takeUntil(this.destroy$))
2852
- .subscribe(function (event) {
2933
+ .subscribe(function () {
2853
2934
  if (!_this.dragContainer.linkDraggingId) {
2854
2935
  _this.barElement.classList.remove(activeClass);
2855
2936
  }
@@ -2912,7 +2993,7 @@
2912
2993
  if (width > dragMinWidth) {
2913
2994
  _this.barElement.style.width = width + 'px';
2914
2995
  _this.barElement.style.left = x + 'px';
2915
- _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), _this.ganttUpper.view.getDateByXPoint(x + width));
2996
+ _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(x), _this.item.end);
2916
2997
  _this.item.updateDate(_this.ganttUpper.view.getDateByXPoint(x), _this.item.end);
2917
2998
  }
2918
2999
  }
@@ -2920,7 +3001,7 @@
2920
3001
  var width = _this.item.refs.width + event.distance.x;
2921
3002
  if (width > dragMinWidth) {
2922
3003
  _this.barElement.style.width = width + 'px';
2923
- _this.openDragBackdrop(_this.barElement, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x), _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + width));
3004
+ _this.openDragBackdrop(_this.barElement, _this.item.start, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + width));
2924
3005
  }
2925
3006
  _this.item.updateDate(_this.item.start, _this.ganttUpper.view.getDateByXPoint(_this.item.refs.x + width));
2926
3007
  }
@@ -3003,22 +3084,24 @@
3003
3084
  return dragRefs;
3004
3085
  };
3005
3086
  GanttBarDrag.prototype.openDragBackdrop = function (dragElement, start, end) {
3006
- var dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
3007
- var dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
3087
+ var dragBackdropElement = this.root.backdrop.nativeElement;
3088
+ var dragMaskElement = dragBackdropElement.querySelector('.gantt-drag-mask');
3008
3089
  var rootRect = this.dom.root.getBoundingClientRect();
3009
3090
  var dragRect = dragElement.getBoundingClientRect();
3010
3091
  var left = dragRect.left - rootRect.left - this.dom.side.clientWidth;
3011
3092
  var width = dragRect.right - dragRect.left;
3093
+ // Note: updating styles will cause re-layout so we have to place them consistently one by one.
3012
3094
  dragMaskElement.style.left = left + 'px';
3013
3095
  dragMaskElement.style.width = width + 'px';
3014
- dragMaskElement.querySelector('.start').innerHTML = start.format('MM-dd');
3015
- dragMaskElement.querySelector('.end').innerHTML = end.format('MM-dd');
3016
3096
  dragMaskElement.style.display = 'block';
3017
3097
  dragBackdropElement.style.display = 'block';
3098
+ // This will invalidate the layout, but we won't need re-layout, because we set styles previously.
3099
+ dragMaskElement.querySelector('.start').innerHTML = start.format('MM-dd');
3100
+ dragMaskElement.querySelector('.end').innerHTML = end.format('MM-dd');
3018
3101
  };
3019
3102
  GanttBarDrag.prototype.closeDragBackdrop = function () {
3020
- var dragMaskElement = this.dom.root.querySelector('.gantt-drag-mask');
3021
- var dragBackdropElement = this.dom.root.querySelector('.gantt-drag-backdrop');
3103
+ var dragBackdropElement = this.root.backdrop.nativeElement;
3104
+ var dragMaskElement = dragBackdropElement.querySelector('.gantt-drag-mask');
3022
3105
  dragMaskElement.style.display = 'none';
3023
3106
  dragBackdropElement.style.display = 'none';
3024
3107
  };
@@ -3086,22 +3169,27 @@
3086
3169
  };
3087
3170
  return GanttBarDrag;
3088
3171
  }());
3089
- GanttBarDrag.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttBarDrag, deps: [{ token: i1__namespace.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
3172
+ GanttBarDrag.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttBarDrag, deps: [{ token: i1__namespace.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }, { token: NgxGanttRootComponent, skipSelf: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
3090
3173
  GanttBarDrag.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttBarDrag });
3091
3174
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: GanttBarDrag, decorators: [{
3092
3175
  type: i0.Injectable
3093
- }], ctorParameters: function () { return [{ type: i1__namespace.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }]; } });
3176
+ }], ctorParameters: function () {
3177
+ return [{ type: i1__namespace.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: NgxGanttRootComponent, decorators: [{
3178
+ type: i0.SkipSelf
3179
+ }] }];
3180
+ } });
3094
3181
 
3095
3182
  function linearGradient(sideOrCorner, color, stop) {
3096
3183
  return "linear-gradient(" + sideOrCorner + "," + color + " 0%," + stop + " 40%)";
3097
3184
  }
3098
3185
  var NgxGanttBarComponent = /** @class */ (function (_super) {
3099
3186
  __extends(NgxGanttBarComponent, _super);
3100
- function NgxGanttBarComponent(dragContainer, drag, elementRef, ganttUpper) {
3187
+ function NgxGanttBarComponent(dragContainer, drag, elementRef, ganttUpper, ngZone) {
3101
3188
  var _this = _super.call(this, elementRef, ganttUpper) || this;
3102
3189
  _this.dragContainer = dragContainer;
3103
3190
  _this.drag = drag;
3104
3191
  _this.ganttUpper = ganttUpper;
3192
+ _this.ngZone = ngZone;
3105
3193
  _this.barClick = new i0.EventEmitter();
3106
3194
  _this.ganttItemClass = true;
3107
3195
  _this.color = 'red';
@@ -3109,17 +3197,24 @@
3109
3197
  }
3110
3198
  NgxGanttBarComponent.prototype.ngOnInit = function () {
3111
3199
  var _this = this;
3112
- _super.prototype.onInit.call(this);
3200
+ _super.prototype.ngOnInit.call(this);
3113
3201
  this.dragContainer.dragEnded.pipe(operators.takeUntil(this.unsubscribe$)).subscribe(function () {
3114
3202
  _this.setContentBackground();
3115
3203
  });
3116
3204
  };
3117
3205
  NgxGanttBarComponent.prototype.ngAfterViewInit = function () {
3206
+ var _this = this;
3118
3207
  this.drag.createDrags(this.elementRef, this.item, this.ganttUpper);
3119
3208
  this.setContentBackground();
3120
- };
3121
- NgxGanttBarComponent.prototype.ngOnChanges = function () {
3122
- _super.prototype.onChanges.call(this);
3209
+ this.handles.changes
3210
+ .pipe(operators.startWith(this.handles), operators.switchMap(function () {
3211
+ // Note: we need to explicitly subscribe outside of the Angular zone since `addEventListener`
3212
+ // is called when the `fromEvent` is subscribed.
3213
+ return new rxjs.Observable(function (subscriber) { return _this.ngZone.runOutsideAngular(function () { return rxjs.merge.apply(void 0, __spreadArray([], __read(_this.handles.toArray().map(function (handle) { return rxjs.fromEvent(handle.nativeElement, 'mousedown'); })))).subscribe(subscriber); }); });
3214
+ }), operators.takeUntil(this.unsubscribe$))
3215
+ .subscribe(function (event) {
3216
+ event.stopPropagation();
3217
+ });
3123
3218
  };
3124
3219
  NgxGanttBarComponent.prototype.onBarClick = function (event) {
3125
3220
  this.barClick.emit({ event: event, item: this.item.origin });
@@ -3155,13 +3250,10 @@
3155
3250
  NgxGanttBarComponent.prototype.stopPropagation = function (event) {
3156
3251
  event.stopPropagation();
3157
3252
  };
3158
- NgxGanttBarComponent.prototype.ngOnDestroy = function () {
3159
- _super.prototype.onDestroy.call(this);
3160
- };
3161
3253
  return NgxGanttBarComponent;
3162
3254
  }(GanttItemUpper));
3163
- NgxGanttBarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NgxGanttBarComponent, deps: [{ token: GanttDragContainer }, { token: GanttBarDrag }, { token: i0__namespace.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0__namespace.ɵɵFactoryTarget.Component });
3164
- NgxGanttBarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: { barClick: "barClick" }, host: { properties: { "class.gantt-bar": "this.ganttItemClass" } }, providers: [GanttBarDrag], viewQueries: [{ propertyName: "contentElementRef", first: true, predicate: ["content"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<div class=\"gantt-bar-layer\">\n <div *ngIf=\"item.draggable && ganttUpper.draggable\" class=\"drag-handles\">\n <ng-container>\n <span class=\"handle\" (mousedown)=\"stopPropagation($event)\"></span>\n <span class=\"handle\" (mousedown)=\"stopPropagation($event)\"></span>\n </ng-container>\n </div>\n <div *ngIf=\"item.linkable && ganttUpper.linkable\" class=\"link-handles\">\n <span class=\"handle\"><span class=\"point\"></span></span>\n <span class=\"handle\"> <span class=\"point\"></span></span>\n </div>\n</div>\n<div class=\"gantt-bar-border\"></div>\n<div #content class=\"gantt-bar-content\" (click)=\"onBarClick($event)\">\n <div class=\"gantt-bar-content-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</div>\n", directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
3255
+ NgxGanttBarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NgxGanttBarComponent, deps: [{ token: GanttDragContainer }, { token: GanttBarDrag }, { token: i0__namespace.ElementRef }, { token: GANTT_UPPER_TOKEN }, { token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Component });
3256
+ NgxGanttBarComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, template: "<div class=\"gantt-bar-layer\">\n <div *ngIf=\"item.draggable && ganttUpper.draggable\" class=\"drag-handles\">\n <ng-container>\n <span class=\"handle\" #handle></span>\n <span class=\"handle\" #handle></span>\n </ng-container>\n </div>\n <div *ngIf=\"item.linkable && ganttUpper.linkable\" class=\"link-handles\">\n <span class=\"handle\"><span class=\"point\"></span></span>\n <span class=\"handle\"> <span class=\"point\"></span></span>\n </div>\n</div>\n<div class=\"gantt-bar-border\"></div>\n<div #content class=\"gantt-bar-content\" (click)=\"onBarClick($event)\">\n <div class=\"gantt-bar-content-progress\" *ngIf=\"item.progress >= 0\" [style.width.%]=\"item.progress * 100\"></div>\n <ng-template [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n</div>\n", directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
3165
3257
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NgxGanttBarComponent, decorators: [{
3166
3258
  type: i0.Component,
3167
3259
  args: [{
@@ -3173,7 +3265,7 @@
3173
3265
  return [{ type: GanttDragContainer }, { type: GanttBarDrag }, { type: i0__namespace.ElementRef }, { type: GanttUpper, decorators: [{
3174
3266
  type: i0.Inject,
3175
3267
  args: [GANTT_UPPER_TOKEN]
3176
- }] }];
3268
+ }] }, { type: i0__namespace.NgZone }];
3177
3269
  }, propDecorators: { barClick: [{
3178
3270
  type: i0.Output
3179
3271
  }], contentElementRef: [{
@@ -3182,6 +3274,9 @@
3182
3274
  }], ganttItemClass: [{
3183
3275
  type: i0.HostBinding,
3184
3276
  args: ['class.gantt-bar']
3277
+ }], handles: [{
3278
+ type: i0.ViewChildren,
3279
+ args: ['handle']
3185
3280
  }] } });
3186
3281
 
3187
3282
  var GanttMainComponent = /** @class */ (function () {
@@ -3191,7 +3286,6 @@
3191
3286
  this.lineClick = new i0.EventEmitter();
3192
3287
  this.ganttMainClass = true;
3193
3288
  }
3194
- GanttMainComponent.prototype.ngOnInit = function () { };
3195
3289
  GanttMainComponent.prototype.trackBy = function (index, item) {
3196
3290
  return item.id || index;
3197
3291
  };
@@ -3246,13 +3340,20 @@
3246
3340
  }
3247
3341
  NgxGanttComponent.prototype.ngOnInit = function () {
3248
3342
  var _this = this;
3249
- _super.prototype.onInit.call(this);
3250
- this.ngZone.onStable.pipe(operators.take(1)).subscribe(function () {
3251
- _this.dragContainer.linkDragStarted.pipe(operators.takeUntil(_this.ngUnsubscribe$)).subscribe(function (event) {
3252
- _this.linkDragStarted.emit(event);
3253
- });
3254
- _this.dragContainer.linkDragEnded.pipe(operators.takeUntil(_this.ngUnsubscribe$)).subscribe(function (event) {
3255
- _this.linkDragEnded.emit(event);
3343
+ _super.prototype.ngOnInit.call(this);
3344
+ // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
3345
+ // the `onStable` will never emit any value.
3346
+ var onStable$ = this.ngZone.isStable ? rxjs.from(Promise.resolve()) : this.ngZone.onStable.pipe(operators.take(1));
3347
+ // Normally this isn't in the zone, but it can cause performance regressions for apps
3348
+ // using `zone-patch-rxjs` because it'll trigger a change detection when it unsubscribes.
3349
+ this.ngZone.runOutsideAngular(function () {
3350
+ onStable$.pipe(operators.takeUntil(_this.unsubscribe$)).subscribe(function () {
3351
+ _this.dragContainer.linkDragStarted.pipe(operators.takeUntil(_this.ngUnsubscribe$)).subscribe(function (event) {
3352
+ _this.linkDragStarted.emit(event);
3353
+ });
3354
+ _this.dragContainer.linkDragEnded.pipe(operators.takeUntil(_this.ngUnsubscribe$)).subscribe(function (event) {
3355
+ _this.linkDragEnded.emit(event);
3356
+ });
3256
3357
  });
3257
3358
  });
3258
3359
  };
@@ -3267,9 +3368,6 @@
3267
3368
  _this.cdr.detectChanges();
3268
3369
  });
3269
3370
  };
3270
- NgxGanttComponent.prototype.ngOnChanges = function (changes) {
3271
- _super.prototype.onChanges.call(this, changes);
3272
- };
3273
3371
  NgxGanttComponent.prototype.expandChildren = function (item) {
3274
3372
  var _this = this;
3275
3373
  if (!item.expanded) {
@@ -3314,9 +3412,6 @@
3314
3412
  this.selectedChange.emit({ event: event, selectedValue: _selectedValue });
3315
3413
  }
3316
3414
  };
3317
- NgxGanttComponent.prototype.ngOnDestroy = function () {
3318
- _super.prototype.onDestroy.call(this);
3319
- };
3320
3415
  return NgxGanttComponent;
3321
3416
  }(GanttUpper));
3322
3417
  NgxGanttComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NgxGanttComponent, deps: [{ token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }, { token: i0__namespace.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0__namespace.ɵɵFactoryTarget.Component });
@@ -3329,7 +3424,7 @@
3329
3424
  provide: GANTT_ABSTRACT_TOKEN,
3330
3425
  useExisting: i0.forwardRef(function () { return NgxGanttComponent; })
3331
3426
  }
3332
- ], queries: [{ propertyName: "table", first: true, predicate: NgxGanttTableComponent, descendants: true }, { propertyName: "tableEmptyTemplate", first: true, predicate: ["tableEmpty"], descendants: true, static: true }, { propertyName: "columns", predicate: NgxGanttTableColumnComponent, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<ngx-gantt-root>\n <ng-template #sideTemplate>\n <gantt-table\n [groups]=\"groups\"\n [items]=\"items\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n (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__namespace.ChangeDetectionStrategy.OnPush });
3427
+ ], 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__namespace, template: "<ngx-gantt-root>\n <ng-template #sideTemplate>\n <gantt-table\n [groups]=\"groups\"\n [items]=\"items\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n (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__namespace.ChangeDetectionStrategy.OnPush });
3333
3428
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NgxGanttComponent, decorators: [{
3334
3429
  type: i0.Component,
3335
3430
  args: [{