@worktile/gantt 12.1.0-next.0 → 12.1.0

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 (47) hide show
  1. package/bundles/worktile-gantt.umd.js +721 -928
  2. package/bundles/worktile-gantt.umd.js.map +1 -1
  3. package/class/item.d.ts +0 -1
  4. package/components/calendar/{grid/calendar-grid.component.d.ts → calendar.component.d.ts} +9 -7
  5. package/components/links/links.component.d.ts +3 -2
  6. package/components/main/gantt-main.component.d.ts +3 -3
  7. package/components/table/gantt-table.component.d.ts +36 -0
  8. package/esm2015/class/item.js +1 -1
  9. package/esm2015/components/calendar/calendar.component.js +86 -0
  10. package/esm2015/components/links/links.component.js +42 -19
  11. package/esm2015/components/main/gantt-main.component.js +4 -4
  12. package/esm2015/components/table/gantt-table.component.js +146 -0
  13. package/esm2015/gantt-dom.service.js +2 -5
  14. package/esm2015/gantt-item-upper.js +4 -5
  15. package/esm2015/gantt-print.service.js +2 -2
  16. package/esm2015/gantt-upper.js +46 -33
  17. package/esm2015/gantt.component.js +17 -172
  18. package/esm2015/gantt.config.js +13 -0
  19. package/esm2015/gantt.module.js +22 -18
  20. package/esm2015/public-api.js +2 -1
  21. package/esm2015/root.component.js +7 -8
  22. package/esm2015/utils/helpers.js +10 -9
  23. package/esm2015/views/day.js +2 -2
  24. package/esm2015/views/month.js +3 -3
  25. package/esm2015/views/quarter.js +3 -3
  26. package/esm2015/views/view.js +4 -2
  27. package/esm2015/views/week.js +3 -3
  28. package/esm2015/views/year.js +2 -2
  29. package/fesm2015/worktile-gantt.js +706 -896
  30. package/fesm2015/worktile-gantt.js.map +1 -1
  31. package/gantt-dom.service.d.ts +0 -1
  32. package/gantt-upper.d.ts +7 -3
  33. package/gantt.component.d.ts +5 -26
  34. package/gantt.config.d.ts +23 -0
  35. package/gantt.module.d.ts +13 -16
  36. package/main.bundle.scss +195 -234
  37. package/package.json +1 -1
  38. package/public-api.d.ts +1 -0
  39. package/utils/helpers.d.ts +3 -5
  40. package/views/view.d.ts +2 -0
  41. package/components/calendar/header/calendar-header.component.d.ts +0 -21
  42. package/components/table/body/gantt-table-body.component.d.ts +0 -24
  43. package/components/table/header/gantt-table-header.component.d.ts +0 -29
  44. package/esm2015/components/calendar/grid/calendar-grid.component.js +0 -76
  45. package/esm2015/components/calendar/header/calendar-header.component.js +0 -70
  46. package/esm2015/components/table/body/gantt-table-body.component.js +0 -68
  47. package/esm2015/components/table/header/gantt-table-header.component.js +0 -126
@@ -1,15 +1,13 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Directive, Input, Output, ContentChild, HostBinding, InjectionToken, Component, Inject, Injectable, ViewChild, Pipe, forwardRef, ChangeDetectionStrategy, Optional, ContentChildren, NgModule } from '@angular/core';
3
- import * as i1 from '@angular/common';
2
+ import { InjectionToken, EventEmitter, Directive, Inject, Input, Output, ContentChild, HostBinding, Component, Pipe, ViewChild, Injectable, Optional, forwardRef, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
3
+ import * as i2 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import { take, skip, takeUntil, startWith, map, pairwise, auditTime, finalize } from 'rxjs/operators';
6
6
  import { BehaviorSubject, Subject, merge, fromEvent } from 'rxjs';
7
7
  import { fromUnixTime, getWeek, getDaysInMonth, differenceInCalendarDays, setDate, addSeconds, addMinutes, addHours, addDays, addWeeks, addMonths, addQuarters, addYears, startOfDay, startOfWeek, startOfMonth, startOfQuarter, startOfYear, endOfDay, endOfWeek, endOfMonth, endOfQuarter, endOfYear, getUnixTime, format, isWeekend, isToday, differenceInDays, differenceInCalendarQuarters, eachMonthOfInterval, eachYearOfInterval, eachWeekOfInterval, eachDayOfInterval, differenceInCalendarYears } from 'date-fns';
8
8
  export { addDays, addHours, addMinutes, addMonths, addQuarters, addSeconds, addWeeks, addYears, differenceInCalendarDays, differenceInCalendarQuarters, differenceInDays, eachDayOfInterval, eachMonthOfInterval, eachWeekOfInterval, endOfDay, endOfMonth, endOfQuarter, endOfWeek, endOfYear, format, fromUnixTime, getDaysInMonth, getUnixTime, getWeek, isToday, isWeekend, setDate, startOfDay, startOfMonth, startOfQuarter, startOfWeek, startOfYear } from 'date-fns';
9
9
  import { coerceCssPixelValue } from '@angular/cdk/coercion';
10
- import * as i6 from '@angular/cdk/scrolling';
11
- import { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';
12
- import * as i1$1 from '@angular/cdk/drag-drop';
10
+ import * as i1 from '@angular/cdk/drag-drop';
13
11
  import { DragDropModule } from '@angular/cdk/drag-drop';
14
12
  import html2canvas from 'html2canvas';
15
13
 
@@ -295,11 +293,24 @@ class GanttGroupInternal {
295
293
  }
296
294
  }
297
295
 
296
+ const defaultConfig = {
297
+ dateFormat: {
298
+ week: '第w周',
299
+ month: 'M月',
300
+ quarter: 'QQQ',
301
+ year: 'yyyy年',
302
+ yearMonth: 'yyyy年MM月',
303
+ yearQuarter: 'yyyy年QQQ',
304
+ }
305
+ };
306
+ const GANTT_GLOBAL_CONFIG = new InjectionToken('GANTT_GLOBAL_CONFIG');
307
+
298
308
  const primaryDatePointTop = 18;
299
309
  const secondaryDatePointTop = 36;
300
310
  const viewOptions$5 = {
301
311
  min: new GanttDate().addYears(-1).startOfYear(),
302
- max: new GanttDate().addYears(1).endOfYear()
312
+ max: new GanttDate().addYears(1).endOfYear(),
313
+ dateFormat: defaultConfig.dateFormat
303
314
  };
304
315
  class GanttView {
305
316
  constructor(start, end, options) {
@@ -442,7 +453,7 @@ class GanttViewMonth extends GanttView {
442
453
  const points = [];
443
454
  for (let i = 0; i < quarters; i++) {
444
455
  const start = this.start.addQuarters(i);
445
- const point = new GanttDatePoint(start, start.format('yyyy年QQQ'), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
456
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat.yearQuarter), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
446
457
  points.push(point);
447
458
  }
448
459
  return points;
@@ -452,7 +463,7 @@ class GanttViewMonth extends GanttView {
452
463
  const points = [];
453
464
  for (let i = 0; i < months.length; i++) {
454
465
  const start = new GanttDate(months[i]);
455
- const point = new GanttDatePoint(start, `${start.getMonth() + 1}月`, i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
466
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat.month), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
456
467
  points.push(point);
457
468
  }
458
469
  return points;
@@ -489,7 +500,7 @@ class GanttViewQuarter extends GanttView {
489
500
  const points = [];
490
501
  for (let i = 0; i < years.length; i++) {
491
502
  const start = new GanttDate(years[i]);
492
- const point = new GanttDatePoint(start, `${start.format('yyyy')}年`, (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
503
+ const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat.year)}`, (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
493
504
  points.push(point);
494
505
  }
495
506
  return points;
@@ -499,7 +510,7 @@ class GanttViewQuarter extends GanttView {
499
510
  const points = [];
500
511
  for (let i = 0; i <= quarters; i++) {
501
512
  const start = this.start.addQuarters(i);
502
- const point = new GanttDatePoint(start, start.format('QQQ'), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
513
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat.quarter), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
503
514
  points.push(point);
504
515
  }
505
516
  return points;
@@ -537,7 +548,7 @@ class GanttViewDay extends GanttView {
537
548
  for (let i = 0; i < weeks.length; i++) {
538
549
  const weekStart = new GanttDate(weeks[i]);
539
550
  const increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
540
- const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format('yyyy年MM月'), (this.getCellWidth() * 7) / 2 + i * (this.getCellWidth() * 7), primaryDatePointTop);
551
+ const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.yearMonth), (this.getCellWidth() * 7) / 2 + i * (this.getCellWidth() * 7), primaryDatePointTop);
541
552
  points.push(point);
542
553
  }
543
554
  return points;
@@ -586,7 +597,7 @@ class GanttViewWeek extends GanttView {
586
597
  for (let i = 0; i < weeks.length; i++) {
587
598
  const weekStart = new GanttDate(weeks[i]);
588
599
  const increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
589
- const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format('yyyy年'), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
600
+ const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.year), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
590
601
  points.push(point);
591
602
  }
592
603
  return points;
@@ -596,7 +607,7 @@ class GanttViewWeek extends GanttView {
596
607
  const points = [];
597
608
  for (let i = 0; i < weeks.length; i++) {
598
609
  const start = new GanttDate(weeks[i]);
599
- const point = new GanttDatePoint(start, `第${start.format('w')}周`, i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
610
+ const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat.week)}`, i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
600
611
  points.push(point);
601
612
  }
602
613
  return points;
@@ -642,7 +653,7 @@ class GanttViewYear extends GanttView {
642
653
  const pointTop = 27;
643
654
  for (let i = 0; i <= years; i++) {
644
655
  const start = this.start.addYears(i);
645
- const point = new GanttDatePoint(start, `${start.format('yyyy')}年`, i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
656
+ const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat.year)}`, i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
646
657
  points.push(point);
647
658
  }
648
659
  return points;
@@ -715,40 +726,42 @@ function flatten(array) {
715
726
  return pre.concat(Array.isArray(cur) ? flatten(cur) : cur);
716
727
  }, []);
717
728
  }
718
- function recursiveItems(items, level) {
729
+ function recursiveItems(items) {
719
730
  const result = [];
720
731
  (items || []).forEach((item) => {
721
- item.level = level;
722
732
  result.push(item);
723
733
  if (item.expanded && item.children) {
724
- result.push(...recursiveItems(item.children, level + 1));
734
+ result.push(...recursiveItems(item.children));
725
735
  }
726
736
  });
727
737
  return result;
728
738
  }
729
- function keyBy(array, key) {
730
- const result = {};
731
- array.forEach(item => {
732
- const keyValue = item[key];
733
- result[keyValue] = item;
739
+ function getFlatItems(items) {
740
+ const result = [];
741
+ (items || []).forEach((item) => {
742
+ result.push(item);
743
+ if (item.children) {
744
+ result.push(...getFlatItems(item.children));
745
+ }
734
746
  });
735
747
  return result;
736
748
  }
737
749
 
738
750
  class GanttUpper {
739
- constructor(elementRef, cdr, ngZone) {
751
+ constructor(elementRef, cdr, ngZone, config) {
740
752
  this.elementRef = elementRef;
741
753
  this.cdr = cdr;
742
754
  this.ngZone = ngZone;
755
+ this.config = config;
743
756
  this.originItems = [];
744
757
  this.originGroups = [];
745
758
  this.viewType = GanttViewType.month;
746
759
  this.showTodayLine = true;
760
+ this.viewOptions = {};
747
761
  this.loadOnScroll = new EventEmitter();
748
762
  this.dragStarted = new EventEmitter();
749
763
  this.dragEnded = new EventEmitter();
750
764
  this.barClick = new EventEmitter();
751
- this.computeAllRefs = true;
752
765
  this.linkDragEnded = new EventEmitter();
753
766
  this.items = [];
754
767
  this.groups = [];
@@ -756,7 +769,6 @@ class GanttUpper {
756
769
  this.expandChange = new EventEmitter();
757
770
  this.firstChange = true;
758
771
  this.unsubscribe$ = new Subject();
759
- this.expandedItemIds = [];
760
772
  this.ganttClass = true;
761
773
  }
762
774
  get element() {
@@ -779,21 +791,6 @@ class GanttUpper {
779
791
  }
780
792
  setupItems() {
781
793
  this.originItems = uniqBy(this.originItems, 'id');
782
- // 根据上一次数据展开状态同步新的数据展开状态
783
- this.originItems.forEach((originItem) => {
784
- var _a, _b;
785
- const oldItem = this.items.find((item) => {
786
- return item.id === originItem.id;
787
- });
788
- if (!this.firstChange) {
789
- if (oldItem && !((_a = oldItem.children) === null || _a === void 0 ? void 0 : _a.length) && ((_b = originItem.children) === null || _b === void 0 ? void 0 : _b.length)) {
790
- originItem.expanded = originItem.expanded || this.expandedItemIds.includes(originItem.id);
791
- }
792
- else {
793
- originItem.expanded = this.expandedItemIds.includes(originItem.id);
794
- }
795
- }
796
- });
797
794
  this.items = [];
798
795
  if (this.groups.length > 0) {
799
796
  this.originItems.forEach((origin) => {
@@ -812,17 +809,23 @@ class GanttUpper {
812
809
  }
813
810
  }
814
811
  setupExpandedState() {
812
+ this.originItems = uniqBy(this.originItems, 'id');
815
813
  let items = [];
814
+ const flatOriginItems = getFlatItems(this.originItems);
816
815
  if (this.items.length > 0) {
817
816
  items = recursiveItems(this.items);
818
817
  }
819
818
  else {
820
819
  items = flatten(this.groups.map((group) => recursiveItems(group.items)));
821
820
  }
822
- this.expandedItemIds = [];
823
821
  items.forEach((item) => {
824
822
  if (item.origin.expanded) {
825
- this.expandedItemIds.push(item.id);
823
+ const newItem = flatOriginItems.find((originItem) => originItem.id === item.id);
824
+ if (newItem) {
825
+ if (newItem.expanded === undefined) {
826
+ newItem.expanded = true;
827
+ }
828
+ }
826
829
  }
827
830
  });
828
831
  }
@@ -851,17 +854,23 @@ class GanttUpper {
851
854
  };
852
855
  }
853
856
  computeRefs() {
854
- if (this.computeAllRefs) {
855
- this.groups.forEach((group) => {
856
- const groupItems = recursiveItems(group.items);
857
- this.computeItemsRefs(...groupItems);
858
- });
859
- const items = recursiveItems(this.items);
860
- this.computeItemsRefs(...items);
861
- }
857
+ this.groups.forEach((group) => {
858
+ const groupItems = recursiveItems(group.items);
859
+ this.computeItemsRefs(...groupItems);
860
+ });
861
+ const items = recursiveItems(this.items);
862
+ this.computeItemsRefs(...items);
863
+ }
864
+ expandGroups(expanded) {
865
+ this.groups.forEach((group) => {
866
+ group.setExpand(expanded);
867
+ });
868
+ this.expandChange.next();
869
+ this.cdr.detectChanges();
862
870
  }
863
871
  onInit() {
864
872
  this.styles = Object.assign({}, defaultStyles, this.styles);
873
+ this.viewOptions.dateFormat = Object.assign({}, defaultConfig.dateFormat, this.config.dateFormat, this.viewOptions.dateFormat);
865
874
  this.createView();
866
875
  this.setupGroups();
867
876
  this.setupItems();
@@ -918,12 +927,27 @@ class GanttUpper {
918
927
  detectChanges() {
919
928
  this.cdr.detectChanges();
920
929
  }
930
+ expandGroup(group) {
931
+ group.setExpand(!group.expanded);
932
+ this.expandChange.emit();
933
+ this.cdr.detectChanges();
934
+ }
935
+ // public functions
936
+ expandAll() {
937
+ this.expandGroups(true);
938
+ }
939
+ collapseAll() {
940
+ this.expandGroups(false);
941
+ }
921
942
  }
922
- 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 }], target: i0.ɵɵFactoryTarget.Directive });
943
+ 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 });
923
944
  GanttUpper.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.2", type: GanttUpper, inputs: { originItems: ["items", "originItems"], originGroups: ["groups", "originGroups"], viewType: "viewType", start: "start", end: "end", showTodayLine: "showTodayLine", draggable: "draggable", styles: "styles", viewOptions: "viewOptions", disabledLoadOnScroll: "disabledLoadOnScroll" }, outputs: { loadOnScroll: "loadOnScroll", dragStarted: "dragStarted", 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 });
924
945
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttUpper, decorators: [{
925
946
  type: Directive
926
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { originItems: [{
947
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
948
+ type: Inject,
949
+ args: [GANTT_GLOBAL_CONFIG]
950
+ }] }]; }, propDecorators: { originItems: [{
927
951
  type: Input,
928
952
  args: ['items']
929
953
  }], originGroups: [{
@@ -1024,174 +1048,178 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1024
1048
  type: Output
1025
1049
  }] } });
1026
1050
 
1027
- const scrollThreshold = 50;
1028
- var ScrollDirection;
1029
- (function (ScrollDirection) {
1030
- ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1031
- ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1032
- ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1033
- })(ScrollDirection || (ScrollDirection = {}));
1034
- class GanttDomService {
1035
- constructor() {
1036
- this.unsubscribe$ = new Subject();
1037
- }
1038
- monitorScrollChange() {
1039
- merge(fromEvent(this.mainContainer, 'scroll'), fromEvent(this.sideContainer, 'scroll'))
1040
- .pipe(takeUntil(this.unsubscribe$))
1041
- .subscribe((event) => {
1042
- this.syncScroll(event);
1043
- });
1044
- fromEvent(this.mainContainer, 'scroll')
1045
- .pipe(startWith(), takeUntil(this.unsubscribe$))
1046
- .subscribe((event) => {
1047
- // if (this.mainContainer.scrollLeft > 0) {
1048
- // this.side.classList.add('gantt-side-has-shadow');
1049
- // } else {
1050
- // this.side.classList.remove('gantt-side-has-shadow');
1051
- // }
1052
- });
1053
- }
1054
- syncScroll(event) {
1055
- const target = event.currentTarget;
1056
- this.calendarHeader.scrollLeft = this.mainContainer.scrollLeft;
1057
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1058
- this.sideContainer.scrollTop = target.scrollTop;
1059
- this.mainContainer.scrollTop = target.scrollTop;
1060
- }
1061
- disableBrowserWheelEvent() {
1062
- const container = this.mainContainer;
1063
- fromEvent(container, 'wheel')
1064
- .pipe(takeUntil(this.unsubscribe$))
1065
- .subscribe((event) => {
1066
- const delta = event.deltaX;
1067
- if (!delta) {
1068
- return;
1069
- }
1070
- if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1071
- (container.scrollLeft === 0 && delta < 0)) {
1072
- event.preventDefault();
1073
- }
1074
- });
1075
- }
1076
- initialize(root) {
1077
- this.root = root.nativeElement;
1078
- this.side = this.root.getElementsByClassName('gantt-side')[0];
1079
- this.container = this.root.getElementsByClassName('gantt-container')[0];
1080
- this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
1081
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1082
- this.calendarHeader = this.root.getElementsByClassName('gantt-calendar-header')[0];
1083
- this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-grid')[0];
1084
- this.monitorScrollChange();
1085
- this.disableBrowserWheelEvent();
1086
- }
1087
- getViewerScroll() {
1088
- return fromEvent(this.mainContainer, 'scroll').pipe(map(() => this.mainContainer.scrollLeft), pairwise(), map(([previous, current]) => {
1089
- const event = {
1090
- target: this.mainContainer,
1091
- direction: ScrollDirection.NONE
1092
- };
1093
- if (current - previous < 0) {
1094
- if (this.mainContainer.scrollLeft < scrollThreshold && this.mainContainer.scrollLeft > 0) {
1095
- event.direction = ScrollDirection.LEFT;
1096
- }
1097
- }
1098
- if (current - previous > 0) {
1099
- if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft < scrollThreshold) {
1100
- event.direction = ScrollDirection.RIGHT;
1101
- }
1102
- }
1103
- return event;
1104
- }));
1051
+ const GANTT_ABSTRACT_TOKEN = new InjectionToken('gantt-abstract-token');
1052
+
1053
+ 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>`;
1054
+ 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>`;
1055
+ 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>`;
1056
+ const minusSquare = `<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="jnaction/minus-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-.8H2zm2.8 6.2h6.5v1.2H4.8V7.4z"></path></g></svg>`;
1057
+ const loadingIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50" xml:space="preserve">
1058
+ <path fill="#aaa" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)">
1059
+ <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform>
1060
+ </path>
1061
+ </svg>`;
1062
+ const emptyIcon = `<svg
1063
+ width="148px"
1064
+ height="134px"
1065
+ viewBox="0 0 148 134"
1066
+ version="1.1"
1067
+ xmlns="http://www.w3.org/2000/svg"
1068
+ xmlns:xlink="http://www.w3.org/1999/xlink"
1069
+ >
1070
+ <defs>
1071
+ <filter x="0.0%" y="0.0%" width="100.0%" height="100.0%" filterUnits="objectBoundingBox" id="filter-1">
1072
+ <feGaussianBlur stdDeviation="0" in="SourceGraphic"></feGaussianBlur>
1073
+ </filter>
1074
+ </defs>
1075
+ <g id="148x134" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
1076
+ <g id="编组-6" transform="translate(1.000000, 1.000000)">
1077
+ <ellipse
1078
+ id="椭圆形"
1079
+ fill="#EDEEF2"
1080
+ opacity="0.3"
1081
+ filter="url(#filter-1)"
1082
+ cx="73.0800017"
1083
+ cy="115.920003"
1084
+ rx="73.0800017"
1085
+ ry="16.8000004"
1086
+ ></ellipse>
1087
+ <g id="编组-5" transform="translate(15.120000, 0.000000)">
1088
+ <polygon
1089
+ id="矩形"
1090
+ fill="#E2E4E9"
1091
+ points="19.2789848 49.5600011 99.1200023 48.7200011 117.600003 75.9297673 117.600003 92.313049 0 92.313049 0 75.0356267"
1092
+ ></polygon>
1093
+ <path
1094
+ d="M23.5200005,0 L94.0800002,0 C97.7913538,2.06413823e-16 100.8,3.00864655 100.8,6.72000015 L100.8,99.1200023 L100.8,99.1200023 L16.8000004,99.1200023 L16.8000004,6.72000015 C16.8000004,3.00864655 19.8086469,1.56994302e-15 23.5200005,0 Z"
1095
+ id="矩形"
1096
+ fill="#F9FAFB"
1097
+ ></path>
1098
+ <path
1099
+ d="M30.9200007,12.4400003 L86.6800019,12.4400003 C88.5356787,12.4400003 90.040002,13.9443236 90.040002,15.8000004 L90.040002,42.000001 C90.040002,43.8556778 88.5356787,45.360001 86.6800019,45.360001 L30.9200007,45.360001 C29.0643239,45.360001 27.5600006,43.8556778 27.5600006,42.000001 L27.5600006,15.8000004 C27.5600006,13.9443236 29.0643239,12.4400003 30.9200007,12.4400003 Z"
1100
+ id="矩形"
1101
+ fill="#E8EAEE"
1102
+ ></path>
1103
+ <text
1104
+ id="&lt;/null&gt;"
1105
+ font-family="PingFangSC-Medium, PingFang SC"
1106
+ font-size="15.1200003"
1107
+ font-weight="400"
1108
+ fill="#BCBECD"
1109
+ >
1110
+ <tspan x="33.6000008" y="32.8000004">&lt;/null&gt;</tspan>
1111
+ </text>
1112
+ <rect id="矩形" fill="#E8EAEE" x="27.5600006" y="52.0800012" width="61.4800014" height="5.04000011" rx="2.52000006"></rect>
1113
+ <rect
1114
+ id="矩形备份"
1115
+ fill="#E8EAEE"
1116
+ x="27.5600006"
1117
+ y="63.8400014"
1118
+ width="61.4800014"
1119
+ height="5.04000011"
1120
+ rx="2.52000006"
1121
+ ></rect>
1122
+ <path
1123
+ d="M0,75.6000017 L29.280235,75.6000017 C32.0637502,75.6000017 34.3202352,77.8564866 34.3202352,80.6400018 L34.3202352,86.2591426 C34.3202352,89.0426578 36.5767201,91.2991427 39.3602353,91.2991427 L78.4136737,91.2991427 C81.1971889,91.2991427 83.4536738,89.0426578 83.4536738,86.2591426 L83.4536738,80.6400018 C83.4536738,77.8564866 85.7101587,75.6000017 88.4936739,75.6000017 L117.600003,75.6000017 L117.600003,75.6000017 L117.600003,110.880003 C117.600003,115.519195 113.839194,119.280003 109.200002,119.280003 L8.40000019,119.280003 C3.76080819,119.280003 -6.53729019e-15,115.519195 0,110.880003 L0,75.6000017 L0,75.6000017 Z"
1124
+ id="矩形"
1125
+ fill="#EDEFF2"
1126
+ ></path>
1127
+ </g>
1128
+ </g>
1129
+ </g>
1130
+ </svg>`;
1131
+ const icons = {
1132
+ 'angle-right': angleRight,
1133
+ 'angle-down': angleDown,
1134
+ 'plus-square': plusSquare,
1135
+ 'minus-square': minusSquare,
1136
+ loading: loadingIcon,
1137
+ empty: emptyIcon
1138
+ };
1139
+
1140
+ class GanttIconComponent {
1141
+ constructor(elementRef) {
1142
+ this.elementRef = elementRef;
1143
+ this.isIcon = true;
1105
1144
  }
1106
- getResize() {
1107
- return fromEvent(window, 'resize').pipe(auditTime(150));
1145
+ set iconName(name) {
1146
+ this.setSvg(name);
1108
1147
  }
1109
- scrollMainContainer(left) {
1110
- if (isNumber(left)) {
1111
- const scrollLeft = left - this.mainContainer.clientWidth / 2;
1112
- this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
1113
- this.calendarHeader.scrollLeft = this.mainContainer.scrollLeft;
1114
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1148
+ ngOnInit() { }
1149
+ ngAfterViewInit() { }
1150
+ setSvg(name) {
1151
+ const iconSvg = icons[name];
1152
+ if (iconSvg) {
1153
+ this.elementRef.nativeElement.innerHTML = iconSvg;
1154
+ }
1155
+ else {
1156
+ this.elementRef.nativeElement.innerHTML = '';
1115
1157
  }
1116
- }
1117
- ngOnDestroy() {
1118
- this.unsubscribe$.next();
1119
- this.unsubscribe$.complete();
1120
1158
  }
1121
1159
  }
1122
- GanttDomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1123
- GanttDomServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService });
1124
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService, decorators: [{
1125
- type: Injectable
1126
- }], ctorParameters: function () { return []; } });
1160
+ GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1161
+ GanttIconComponentcmp = 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 });
1162
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttIconComponent, decorators: [{
1163
+ type: Component,
1164
+ args: [{
1165
+ selector: 'gantt-icon',
1166
+ template: ''
1167
+ }]
1168
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { isIcon: [{
1169
+ type: HostBinding,
1170
+ args: ['class.gantt-icon']
1171
+ }], iconName: [{
1172
+ type: Input
1173
+ }] } });
1127
1174
 
1128
- class GanttDragContainer {
1129
- constructor() {
1130
- this.dragStarted = new EventEmitter();
1131
- this.dragEnded = new EventEmitter();
1132
- this.linkDragStarted = new EventEmitter();
1133
- this.linkDragEntered = new EventEmitter();
1134
- this.linkDragEnded = new EventEmitter();
1135
- }
1136
- emitLinkDragStarted(from, item) {
1137
- this.linkDraggingId = item.id;
1138
- this.linkDragFrom = from;
1139
- this.linkDragSource = this.linkDragFrom === 'source' ? item : null;
1140
- this.linkDragTarget = this.linkDragFrom === 'target' ? item : null;
1141
- this.linkDragStarted.emit({
1142
- source: this.linkDragSource && this.linkDragSource.origin,
1143
- target: this.linkDragTarget && this.linkDragTarget.origin
1144
- });
1145
- }
1146
- emitLinkDragEntered(item) {
1147
- if (this.linkDragFrom === 'source') {
1148
- this.linkDragTarget = item;
1149
- }
1150
- else {
1151
- this.linkDragSource = item;
1152
- }
1153
- this.linkDragEntered.emit({
1154
- source: this.linkDragSource.origin,
1155
- target: this.linkDragTarget.origin
1156
- });
1175
+ class IsGanttRangeItemPipe {
1176
+ transform(value) {
1177
+ return value === GanttItemType.range;
1157
1178
  }
1158
- emitLinkDragLeaved() {
1159
- if (this.linkDragFrom === 'source') {
1160
- this.linkDragTarget = null;
1161
- }
1162
- else {
1163
- this.linkDragSource = null;
1164
- }
1179
+ }
1180
+ IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1181
+ IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1182
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
1183
+ type: Pipe,
1184
+ args: [{
1185
+ name: 'isGanttRangeItem'
1186
+ }]
1187
+ }] });
1188
+ class IsGanttBarItemPipe {
1189
+ transform(value) {
1190
+ return value === GanttItemType.bar;
1165
1191
  }
1166
- emitLinkDragEnded() {
1167
- this.linkDraggingId = null;
1168
- if (this.linkDragSource && this.linkDragTarget) {
1169
- this.linkDragSource.addLink(this.linkDragTarget.id);
1170
- this.linkDragEnded.emit({
1171
- source: this.linkDragSource.origin,
1172
- target: this.linkDragTarget.origin
1173
- });
1174
- }
1175
- this.linkDragSource = null;
1176
- this.linkDragTarget = null;
1192
+ }
1193
+ IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1194
+ IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1195
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
1196
+ type: Pipe,
1197
+ args: [{
1198
+ name: 'isGanttBarItem'
1199
+ }]
1200
+ }] });
1201
+ class IsGanttCustomItemPipe {
1202
+ transform(value) {
1203
+ return value === GanttItemType.custom;
1177
1204
  }
1178
1205
  }
1179
- GanttDragContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1180
- GanttDragContainerprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer });
1181
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer, decorators: [{
1182
- type: Injectable
1183
- }], ctorParameters: function () { return []; } });
1184
-
1185
- const GANTT_ABSTRACT_TOKEN = new InjectionToken('gantt-abstract-token');
1206
+ IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1207
+ IsGanttCustomItemPipepipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1208
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
1209
+ type: Pipe,
1210
+ args: [{
1211
+ name: 'isGanttCustomItem'
1212
+ }]
1213
+ }] });
1186
1214
 
1187
1215
  const defaultColumnWidth = 100;
1188
1216
  const minColumnWidth = 80;
1189
- class GanttTableHeaderComponent {
1190
- constructor(elementRef, gantt) {
1191
- this.elementRef = elementRef;
1217
+ class GanttTableComponent {
1218
+ constructor(gantt, elementRef) {
1192
1219
  this.gantt = gantt;
1193
- this.tableWidth = 0;
1194
- this.className = `gantt-table-header gantt-table-row`;
1220
+ this.elementRef = elementRef;
1221
+ this.ganttTableClass = true;
1222
+ this.ganttTableEmptyClass = false;
1195
1223
  }
1196
1224
  set columns(columns) {
1197
1225
  columns.forEach((column) => {
@@ -1202,14 +1230,26 @@ class GanttTableHeaderComponent {
1202
1230
  this.columnList = columns;
1203
1231
  }
1204
1232
  ngOnInit() { }
1205
- ngAfterViewInit() {
1206
- this.tableWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
1233
+ ngOnChanges(changes) {
1234
+ var _a, _b;
1235
+ 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)) {
1236
+ this.ganttTableEmptyClass = true;
1237
+ }
1238
+ else {
1239
+ this.ganttTableEmptyClass = false;
1240
+ }
1207
1241
  }
1208
1242
  dragFixed(config) {
1209
1243
  if (config.movedWidth < config.minWidth) {
1210
1244
  config.target.style.transform = `translate3d(${config.minWidth - config.originWidth}px, 0, 0)`;
1211
1245
  }
1212
1246
  }
1247
+ expandGroup(group) {
1248
+ this.gantt.expandGroup(group);
1249
+ }
1250
+ expandChildren(item) {
1251
+ this.gantt.expandChildren(item);
1252
+ }
1213
1253
  dragStarted(event) {
1214
1254
  const target = event.source.element.nativeElement;
1215
1255
  this.dragStartLeft = target.getBoundingClientRect().left;
@@ -1239,7 +1279,6 @@ class GanttTableHeaderComponent {
1239
1279
  this.showAuxiliaryLine(event);
1240
1280
  }
1241
1281
  columnDragEnded(event, column) {
1242
- const beforeWidth = parseInt(column.columnWidth, 10);
1243
1282
  const target = event.source.element.nativeElement;
1244
1283
  const left = target.getBoundingClientRect().left;
1245
1284
  const width = parseInt(column.columnWidth, 10) + (left - this.dragStartLeft);
@@ -1248,7 +1287,6 @@ class GanttTableHeaderComponent {
1248
1287
  if (this.gantt.table) {
1249
1288
  this.gantt.table.columnChanges.emit({ columns: this.columnList });
1250
1289
  }
1251
- this.tableWidth = this.tableWidth - beforeWidth + columnWidth;
1252
1290
  this.hideAuxiliaryLine();
1253
1291
  event.source.reset();
1254
1292
  }
@@ -1257,15 +1295,12 @@ class GanttTableHeaderComponent {
1257
1295
  const left = target.getBoundingClientRect().left;
1258
1296
  const tableWidth = this.elementRef.nativeElement.getBoundingClientRect().width;
1259
1297
  const dragWidth = left - this.dragStartLeft;
1260
- let tempWidth = 0;
1261
1298
  this.columnList.forEach((column) => {
1262
1299
  const lastColumnWidth = parseInt(column.columnWidth, 10);
1263
1300
  const distributeWidth = parseInt(String(dragWidth * (lastColumnWidth / tableWidth)), 10);
1264
1301
  const columnWidth = Math.max(lastColumnWidth + distributeWidth || 0, minColumnWidth);
1265
1302
  column.columnWidth = coerceCssPixelValue(columnWidth);
1266
- tempWidth += columnWidth;
1267
1303
  });
1268
- this.tableWidth = tempWidth;
1269
1304
  if (this.gantt.table) {
1270
1305
  this.gantt.table.columnChanges.emit({ columns: this.columnList });
1271
1306
  }
@@ -1283,401 +1318,286 @@ class GanttTableHeaderComponent {
1283
1318
  this.draglineElementRef.nativeElement.style.display = 'none';
1284
1319
  }
1285
1320
  }
1286
- GanttTableHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttTableHeaderComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_ABSTRACT_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
1287
- GanttTableHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttTableHeaderComponent, selector: "gantt-table-header", inputs: { columns: "columns" }, host: { properties: { "class": "this.className" } }, viewQueries: [{ propertyName: "draglineElementRef", first: true, predicate: ["dragLine"], descendants: true, static: true }], ngImport: i0, template: "<div\n class=\"gantt-table-column\"\n [class.border-right-0]=\"i === columnList.length - 1\"\n *ngFor=\"let column of columnList; let i = index\"\n [style.width]=\"column.columnWidth\"\n>\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=\"column-drag-trigger 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\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", directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1$1.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragDisabled", "cdkDragStartDelay", "cdkDragLockAxis", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragBoundary", "cdkDragRootElement", "cdkDragPreviewContainer", "cdkDragData", "cdkDragFreeDragPosition"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }] });
1288
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttTableHeaderComponent, decorators: [{
1321
+ GanttTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttTableComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1322
+ 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" }, 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\">\n <div class=\"gantt-table-group\" [ngClass]=\"group.class\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"group.expanded\" (click)=\"expandGroup(group)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"group.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: group.origin, group: group.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ group.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <ng-container *ngIf=\"group.expanded\">\n <ng-template\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ group: group, items: group.items, level: 0 }\"\n ></ng-template>\n </ng-container>\n </ng-container>\n </ng-container>\n</div>\n\n<div\n class=\"gantt-table-drag-trigger\"\n cdkDrag\n cdkDragLockAxis=\"x\"\n cdkDragBoundary=\".gantt\"\n (cdkDragMoved)=\"dragMoved($event)\"\n (cdkDragStarted)=\"dragStarted($event)\"\n (cdkDragEnded)=\"tableDragEnded($event)\"\n></div>\n\n<div #dragLine class=\"gantt-table-drag-auxiliary-line\"></div>\n\n<ng-template #itemsTemplate>\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items, level: 0 }\"></ng-template>\n</ng-template>\n\n<ng-template #ganttItems let-group=\"group\" let-items=\"items\" let-level=\"level\">\n <ng-container *ngFor=\"let item of items\">\n <div\n class=\"gantt-table-item gantt-table-row\"\n [class.gantt-table-item-first-level-group]=\"level === 0 && (item.type | isGanttRangeItem)\"\n [class.gantt-table-item-with-group]=\"group\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n >\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let first = first\" [style.width]=\"column.columnWidth\">\n <div *ngIf=\"first\" class=\"gantt-expand-icon\" [style.marginLeft.px]=\"level * 20\">\n <ng-container *ngIf=\"level < gantt.maxLevel - 1 && item.expandable\">\n <gantt-icon\n *ngIf=\"!item.loading\"\n class=\"expand-icon\"\n [iconName]=\"item.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren(item)\"\n ></gantt-icon>\n <gantt-icon *ngIf=\"item.loading\" [iconName]=\"'loading'\"></gantt-icon>\n </ng-container>\n </div>\n <div class=\"gantt-table-column-content\">\n <ng-template\n [ngTemplateOutlet]=\"column.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: item.origin, item: item.origin }\"\n ></ng-template>\n </div>\n </div>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children, level: level + 1, group: group }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n", components: [{ type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }], directives: [{ type: i2.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 } });
1323
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttTableComponent, decorators: [{
1289
1324
  type: Component,
1290
1325
  args: [{
1291
- selector: 'gantt-table-header',
1292
- templateUrl: './gantt-table-header.component.html'
1326
+ selector: 'gantt-table',
1327
+ templateUrl: './gantt-table.component.html'
1293
1328
  }]
1294
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: undefined, decorators: [{
1329
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1295
1330
  type: Inject,
1296
1331
  args: [GANTT_ABSTRACT_TOKEN]
1297
- }] }]; }, propDecorators: { columns: [{
1332
+ }] }, { type: i0.ElementRef }]; }, propDecorators: { groups: [{
1333
+ type: Input
1334
+ }], items: [{
1335
+ type: Input
1336
+ }], columns: [{
1337
+ type: Input
1338
+ }], groupTemplate: [{
1339
+ type: Input
1340
+ }], emptyTemplate: [{
1298
1341
  type: Input
1299
1342
  }], draglineElementRef: [{
1300
1343
  type: ViewChild,
1301
1344
  args: ['dragLine', { static: true }]
1302
- }], className: [{
1345
+ }], ganttTableClass: [{
1346
+ type: HostBinding,
1347
+ args: ['class.gantt-table']
1348
+ }], ganttTableEmptyClass: [{
1303
1349
  type: HostBinding,
1304
- args: ['class']
1350
+ args: ['class.gantt-table-empty']
1305
1351
  }] } });
1306
1352
 
1307
- class GanttPrintService {
1308
- constructor() { }
1309
- setInlineStyles(targetElem) {
1310
- const svgElements = Array.from(targetElem.getElementsByTagName('svg'));
1311
- for (const svgElement of svgElements) {
1312
- this.recursElementChildren(svgElement);
1313
- }
1353
+ const scrollThreshold = 50;
1354
+ var ScrollDirection;
1355
+ (function (ScrollDirection) {
1356
+ ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1357
+ ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1358
+ ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1359
+ })(ScrollDirection || (ScrollDirection = {}));
1360
+ class GanttDomService {
1361
+ constructor() {
1362
+ this.unsubscribe$ = new Subject();
1314
1363
  }
1315
- recursElementChildren(node) {
1316
- const transformProperties = [
1317
- 'fill',
1318
- 'color',
1319
- 'font-size',
1320
- 'stroke',
1321
- 'font',
1322
- 'text-anchor',
1323
- 'stroke-dasharray',
1324
- 'shape-rendering',
1325
- 'stroke-width'
1326
- ];
1327
- if (!node.style) {
1328
- return;
1329
- }
1330
- const styles = getComputedStyle(node);
1331
- for (const transformProperty of transformProperties) {
1332
- node.style[transformProperty] = styles[transformProperty];
1333
- }
1334
- for (const child of Array.from(node.childNodes)) {
1335
- this.recursElementChildren(child);
1336
- }
1364
+ monitorScrollChange() {
1365
+ merge(fromEvent(this.mainContainer, 'scroll'), fromEvent(this.sideContainer, 'scroll'))
1366
+ .pipe(takeUntil(this.unsubscribe$))
1367
+ .subscribe((event) => {
1368
+ this.syncScroll(event);
1369
+ });
1370
+ fromEvent(this.mainContainer, 'scroll')
1371
+ .pipe(startWith(), takeUntil(this.unsubscribe$))
1372
+ .subscribe((event) => {
1373
+ // if (this.mainContainer.scrollLeft > 0) {
1374
+ // this.side.classList.add('gantt-side-has-shadow');
1375
+ // } else {
1376
+ // this.side.classList.remove('gantt-side-has-shadow');
1377
+ // }
1378
+ });
1337
1379
  }
1338
- register(root) {
1380
+ syncScroll(event) {
1381
+ const target = event.currentTarget;
1382
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1383
+ this.sideContainer.scrollTop = target.scrollTop;
1384
+ this.mainContainer.scrollTop = target.scrollTop;
1385
+ }
1386
+ disableBrowserWheelEvent() {
1387
+ const container = this.mainContainer;
1388
+ fromEvent(container, 'wheel')
1389
+ .pipe(takeUntil(this.unsubscribe$))
1390
+ .subscribe((event) => {
1391
+ const delta = event.deltaX;
1392
+ if (!delta) {
1393
+ return;
1394
+ }
1395
+ if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1396
+ (container.scrollLeft === 0 && delta < 0)) {
1397
+ event.preventDefault();
1398
+ }
1399
+ });
1400
+ }
1401
+ initialize(root) {
1339
1402
  this.root = root.nativeElement;
1403
+ this.side = this.root.getElementsByClassName('gantt-side')[0];
1404
+ this.container = this.root.getElementsByClassName('gantt-container')[0];
1405
+ this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
1340
1406
  this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1407
+ this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-overlay')[0];
1408
+ this.monitorScrollChange();
1409
+ this.disableBrowserWheelEvent();
1341
1410
  }
1342
- print(name = 'download', ignoreElementClass) {
1343
- const root = this.root;
1344
- const mainContainer = this.mainContainer;
1345
- // set print width
1346
- const printWidth = root.offsetWidth;
1347
- // set print height
1348
- const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
1349
- html2canvas(root, {
1350
- logging: false,
1351
- allowTaint: true,
1352
- useCORS: true,
1353
- width: printWidth,
1354
- height: printHeight,
1355
- ignoreElements: (element) => {
1356
- if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
1357
- return true;
1358
- }
1359
- if (element.classList.contains('gantt-calendar-today-overlay')) {
1360
- return true;
1411
+ getViewerScroll() {
1412
+ return fromEvent(this.mainContainer, 'scroll').pipe(map(() => this.mainContainer.scrollLeft), pairwise(), map(([previous, current]) => {
1413
+ const event = {
1414
+ target: this.mainContainer,
1415
+ direction: ScrollDirection.NONE
1416
+ };
1417
+ if (current - previous < 0) {
1418
+ if (this.mainContainer.scrollLeft < scrollThreshold && this.mainContainer.scrollLeft > 0) {
1419
+ event.direction = ScrollDirection.LEFT;
1361
1420
  }
1362
- },
1363
- onclone: (cloneDocument) => {
1364
- const ganttClass = root.className;
1365
- const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
1366
- const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
1367
- const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-grid-main');
1368
- const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
1369
- // change targetDom width
1370
- cloneGanttDom.style.width = `${printWidth}px`;
1371
- cloneGanttDom.style.height = `${printHeight}px`;
1372
- cloneGanttDom.style.overflow = `unset`;
1373
- cloneGanttContainerDom.style.backgroundColor = '#fff';
1374
- cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
1375
- cloneCalendarOverlay.setAttribute('style', `background: transparent`);
1376
- if (cloneLinksOverlay) {
1377
- cloneLinksOverlay.setAttribute('height', `${printHeight}`);
1378
- cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
1421
+ }
1422
+ if (current - previous > 0) {
1423
+ if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft < scrollThreshold) {
1424
+ event.direction = ScrollDirection.RIGHT;
1379
1425
  }
1380
- // setInlineStyles for svg
1381
- this.setInlineStyles(cloneGanttDom);
1382
1426
  }
1383
- }).then((canvas) => {
1384
- const link = document.createElement('a');
1385
- const dataUrl = canvas.toDataURL('image/png');
1386
- link.download = `${name}.png`;
1387
- link.href = dataUrl;
1388
- link.click();
1389
- });
1427
+ return event;
1428
+ }));
1390
1429
  }
1391
- }
1392
- GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1393
- GanttPrintService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService });
1394
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService, decorators: [{
1395
- type: Injectable
1396
- }], ctorParameters: function () { return []; } });
1397
-
1398
- class GanttCalendarHeaderComponent {
1399
- constructor(ganttUpper, ngZone, elementRef) {
1400
- this.ganttUpper = ganttUpper;
1401
- this.ngZone = ngZone;
1402
- this.elementRef = elementRef;
1403
- this.unsubscribe$ = new Subject();
1404
- this.headerHeight = headerHeight;
1405
- this.viewTypes = GanttViewType;
1406
- this.className = `gantt-calendar gantt-calendar-header`;
1407
- }
1408
- get view() {
1409
- return this.ganttUpper.view;
1410
- }
1411
- ngOnInit() {
1412
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
1413
- merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
1414
- .pipe(takeUntil(this.unsubscribe$))
1415
- .subscribe(() => {
1416
- if (this.ganttUpper.viewType === GanttViewType.day)
1417
- this.setTodayPoint();
1418
- });
1419
- });
1430
+ getResize() {
1431
+ return fromEvent(window, 'resize').pipe(auditTime(150));
1420
1432
  }
1421
- setTodayPoint() {
1422
- const x = this.view.getTodayXPoint();
1423
- const today = new GanttDate().getDate();
1424
- const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
1425
- const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
1426
- if (isNumber(x)) {
1427
- if (rect) {
1428
- rect.style.left = `${x - todayWidth / 2}px`;
1429
- rect.style.top = `${headerHeight - todayHeight}px`;
1430
- rect.innerHTML = today.toString();
1431
- }
1432
- }
1433
- else {
1434
- todayEle.style.display = 'none';
1433
+ scrollMainContainer(left) {
1434
+ if (isNumber(left)) {
1435
+ const scrollLeft = left - this.mainContainer.clientWidth / 2;
1436
+ this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
1437
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1435
1438
  }
1436
1439
  }
1437
- trackBy(point, index) {
1438
- return point.text || index;
1440
+ ngOnDestroy() {
1441
+ this.unsubscribe$.next();
1442
+ this.unsubscribe$.complete();
1439
1443
  }
1440
1444
  }
1441
- GanttCalendarHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttCalendarHeaderComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1442
- GanttCalendarHeaderComponentcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header", host: { properties: { "class": "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</div>\n<svg [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]=\"headerHeight\"\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</svg>\n", directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1443
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
1444
- type: Component,
1445
- args: [{
1446
- selector: 'gantt-calendar-header',
1447
- templateUrl: './calendar-header.component.html'
1448
- }]
1449
- }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
1450
- type: Inject,
1451
- args: [GANTT_UPPER_TOKEN]
1452
- }] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
1453
- type: HostBinding,
1454
- args: ['class']
1455
- }] } });
1456
-
1457
- 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>`;
1458
- 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>`;
1459
- 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>`;
1460
- const minusSquare = `<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="jnaction/minus-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-.8H2zm2.8 6.2h6.5v1.2H4.8V7.4z"></path></g></svg>`;
1461
- const loadingIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50" xml:space="preserve">
1462
- <path fill="#aaa" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)">
1463
- <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform>
1464
- </path>
1465
- </svg>`;
1466
- const emptyIcon = `<svg
1467
- width="148px"
1468
- height="134px"
1469
- viewBox="0 0 148 134"
1470
- version="1.1"
1471
- xmlns="http://www.w3.org/2000/svg"
1472
- xmlns:xlink="http://www.w3.org/1999/xlink"
1473
- >
1474
- <defs>
1475
- <filter x="0.0%" y="0.0%" width="100.0%" height="100.0%" filterUnits="objectBoundingBox" id="filter-1">
1476
- <feGaussianBlur stdDeviation="0" in="SourceGraphic"></feGaussianBlur>
1477
- </filter>
1478
- </defs>
1479
- <g id="148x134" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
1480
- <g id="编组-6" transform="translate(1.000000, 1.000000)">
1481
- <ellipse
1482
- id="椭圆形"
1483
- fill="#EDEEF2"
1484
- opacity="0.3"
1485
- filter="url(#filter-1)"
1486
- cx="73.0800017"
1487
- cy="115.920003"
1488
- rx="73.0800017"
1489
- ry="16.8000004"
1490
- ></ellipse>
1491
- <g id="编组-5" transform="translate(15.120000, 0.000000)">
1492
- <polygon
1493
- id="矩形"
1494
- fill="#E2E4E9"
1495
- points="19.2789848 49.5600011 99.1200023 48.7200011 117.600003 75.9297673 117.600003 92.313049 0 92.313049 0 75.0356267"
1496
- ></polygon>
1497
- <path
1498
- d="M23.5200005,0 L94.0800002,0 C97.7913538,2.06413823e-16 100.8,3.00864655 100.8,6.72000015 L100.8,99.1200023 L100.8,99.1200023 L16.8000004,99.1200023 L16.8000004,6.72000015 C16.8000004,3.00864655 19.8086469,1.56994302e-15 23.5200005,0 Z"
1499
- id="矩形"
1500
- fill="#F9FAFB"
1501
- ></path>
1502
- <path
1503
- d="M30.9200007,12.4400003 L86.6800019,12.4400003 C88.5356787,12.4400003 90.040002,13.9443236 90.040002,15.8000004 L90.040002,42.000001 C90.040002,43.8556778 88.5356787,45.360001 86.6800019,45.360001 L30.9200007,45.360001 C29.0643239,45.360001 27.5600006,43.8556778 27.5600006,42.000001 L27.5600006,15.8000004 C27.5600006,13.9443236 29.0643239,12.4400003 30.9200007,12.4400003 Z"
1504
- id="矩形"
1505
- fill="#E8EAEE"
1506
- ></path>
1507
- <text
1508
- id="&lt;/null&gt;"
1509
- font-family="PingFangSC-Medium, PingFang SC"
1510
- font-size="15.1200003"
1511
- font-weight="400"
1512
- fill="#BCBECD"
1513
- >
1514
- <tspan x="33.6000008" y="32.8000004">&lt;/null&gt;</tspan>
1515
- </text>
1516
- <rect id="矩形" fill="#E8EAEE" x="27.5600006" y="52.0800012" width="61.4800014" height="5.04000011" rx="2.52000006"></rect>
1517
- <rect
1518
- id="矩形备份"
1519
- fill="#E8EAEE"
1520
- x="27.5600006"
1521
- y="63.8400014"
1522
- width="61.4800014"
1523
- height="5.04000011"
1524
- rx="2.52000006"
1525
- ></rect>
1526
- <path
1527
- d="M0,75.6000017 L29.280235,75.6000017 C32.0637502,75.6000017 34.3202352,77.8564866 34.3202352,80.6400018 L34.3202352,86.2591426 C34.3202352,89.0426578 36.5767201,91.2991427 39.3602353,91.2991427 L78.4136737,91.2991427 C81.1971889,91.2991427 83.4536738,89.0426578 83.4536738,86.2591426 L83.4536738,80.6400018 C83.4536738,77.8564866 85.7101587,75.6000017 88.4936739,75.6000017 L117.600003,75.6000017 L117.600003,75.6000017 L117.600003,110.880003 C117.600003,115.519195 113.839194,119.280003 109.200002,119.280003 L8.40000019,119.280003 C3.76080819,119.280003 -6.53729019e-15,115.519195 0,110.880003 L0,75.6000017 L0,75.6000017 Z"
1528
- id="矩形"
1529
- fill="#EDEFF2"
1530
- ></path>
1531
- </g>
1532
- </g>
1533
- </g>
1534
- </svg>`;
1535
- const icons = {
1536
- 'angle-right': angleRight,
1537
- 'angle-down': angleDown,
1538
- 'plus-square': plusSquare,
1539
- 'minus-square': minusSquare,
1540
- loading: loadingIcon,
1541
- empty: emptyIcon
1542
- };
1445
+ GanttDomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1446
+ GanttDomServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService });
1447
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDomService, decorators: [{
1448
+ type: Injectable
1449
+ }], ctorParameters: function () { return []; } });
1543
1450
 
1544
- class GanttIconComponent {
1545
- constructor(elementRef) {
1546
- this.elementRef = elementRef;
1547
- this.isIcon = true;
1451
+ class GanttDragContainer {
1452
+ constructor() {
1453
+ this.dragStarted = new EventEmitter();
1454
+ this.dragEnded = new EventEmitter();
1455
+ this.linkDragStarted = new EventEmitter();
1456
+ this.linkDragEntered = new EventEmitter();
1457
+ this.linkDragEnded = new EventEmitter();
1548
1458
  }
1549
- set iconName(name) {
1550
- this.setSvg(name);
1459
+ emitLinkDragStarted(from, item) {
1460
+ this.linkDraggingId = item.id;
1461
+ this.linkDragFrom = from;
1462
+ this.linkDragSource = this.linkDragFrom === 'source' ? item : null;
1463
+ this.linkDragTarget = this.linkDragFrom === 'target' ? item : null;
1464
+ this.linkDragStarted.emit({
1465
+ source: this.linkDragSource && this.linkDragSource.origin,
1466
+ target: this.linkDragTarget && this.linkDragTarget.origin
1467
+ });
1551
1468
  }
1552
- ngOnInit() { }
1553
- ngAfterViewInit() { }
1554
- setSvg(name) {
1555
- const iconSvg = icons[name];
1556
- if (iconSvg) {
1557
- this.elementRef.nativeElement.innerHTML = iconSvg;
1469
+ emitLinkDragEntered(item) {
1470
+ if (this.linkDragFrom === 'source') {
1471
+ this.linkDragTarget = item;
1558
1472
  }
1559
1473
  else {
1560
- this.elementRef.nativeElement.innerHTML = '';
1474
+ this.linkDragSource = item;
1561
1475
  }
1476
+ this.linkDragEntered.emit({
1477
+ source: this.linkDragSource.origin,
1478
+ target: this.linkDragTarget.origin
1479
+ });
1562
1480
  }
1563
- }
1564
- GanttIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1565
- 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 });
1566
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttIconComponent, decorators: [{
1567
- type: Component,
1568
- args: [{
1569
- selector: 'gantt-icon',
1570
- template: ''
1571
- }]
1572
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { isIcon: [{
1573
- type: HostBinding,
1574
- args: ['class.gantt-icon']
1575
- }], iconName: [{
1576
- type: Input
1577
- }] } });
1578
-
1579
- class IsGanttRangeItemPipe {
1580
- transform(value) {
1581
- return value === GanttItemType.range;
1582
- }
1583
- }
1584
- IsGanttRangeItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1585
- IsGanttRangeItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, name: "isGanttRangeItem" });
1586
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
1587
- type: Pipe,
1588
- args: [{
1589
- name: 'isGanttRangeItem'
1590
- }]
1591
- }] });
1592
- class IsGanttBarItemPipe {
1593
- transform(value) {
1594
- return value === GanttItemType.bar;
1481
+ emitLinkDragLeaved() {
1482
+ if (this.linkDragFrom === 'source') {
1483
+ this.linkDragTarget = null;
1484
+ }
1485
+ else {
1486
+ this.linkDragSource = null;
1487
+ }
1595
1488
  }
1596
- }
1597
- IsGanttBarItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1598
- IsGanttBarItemPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, name: "isGanttBarItem" });
1599
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
1600
- type: Pipe,
1601
- args: [{
1602
- name: 'isGanttBarItem'
1603
- }]
1604
- }] });
1605
- class IsGanttCustomItemPipe {
1606
- transform(value) {
1607
- return value === GanttItemType.custom;
1489
+ emitLinkDragEnded() {
1490
+ this.linkDraggingId = null;
1491
+ if (this.linkDragSource && this.linkDragTarget) {
1492
+ this.linkDragSource.addLink(this.linkDragTarget.id);
1493
+ this.linkDragEnded.emit({
1494
+ source: this.linkDragSource.origin,
1495
+ target: this.linkDragTarget.origin
1496
+ });
1497
+ }
1498
+ this.linkDragSource = null;
1499
+ this.linkDragTarget = null;
1608
1500
  }
1609
1501
  }
1610
- IsGanttCustomItemPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1611
- IsGanttCustomItemPipepipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, name: "isGanttCustomItem" });
1612
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
1613
- type: Pipe,
1614
- args: [{
1615
- name: 'isGanttCustomItem'
1616
- }]
1617
- }] });
1502
+ GanttDragContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1503
+ GanttDragContainerprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer });
1504
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragContainer, decorators: [{
1505
+ type: Injectable
1506
+ }], ctorParameters: function () { return []; } });
1618
1507
 
1619
- class GanttTableBodyComponent {
1620
- constructor(gantt) {
1621
- this.gantt = gantt;
1622
- this.ganttTableClass = true;
1623
- this.ganttTableEmptyClass = false;
1508
+ class GanttPrintService {
1509
+ constructor() { }
1510
+ setInlineStyles(targetElem) {
1511
+ const svgElements = Array.from(targetElem.getElementsByTagName('svg'));
1512
+ for (const svgElement of svgElements) {
1513
+ this.recursElementChildren(svgElement);
1514
+ }
1624
1515
  }
1625
- set tempData(data) {
1626
- const firstData = data[0];
1627
- if (firstData && firstData.hasOwnProperty('items')) {
1628
- this.hasGroup = true;
1516
+ recursElementChildren(node) {
1517
+ const transformProperties = [
1518
+ 'fill',
1519
+ 'color',
1520
+ 'font-size',
1521
+ 'stroke',
1522
+ 'font',
1523
+ 'text-anchor',
1524
+ 'stroke-dasharray',
1525
+ 'shape-rendering',
1526
+ 'stroke-width'
1527
+ ];
1528
+ if (!node.style) {
1529
+ return;
1530
+ }
1531
+ const styles = getComputedStyle(node);
1532
+ for (const transformProperty of transformProperties) {
1533
+ node.style[transformProperty] = styles[transformProperty];
1534
+ }
1535
+ for (const child of Array.from(node.childNodes)) {
1536
+ this.recursElementChildren(child);
1629
1537
  }
1630
- this.ganttTableEmptyClass = (data === null || data === void 0 ? void 0 : data.length) ? false : true;
1631
- this.flatData = data;
1632
1538
  }
1633
- set columns(columns) {
1634
- columns.forEach((column) => {
1635
- if (!column.columnWidth) {
1636
- column.columnWidth = coerceCssPixelValue(defaultColumnWidth);
1539
+ register(root) {
1540
+ this.root = root.nativeElement;
1541
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1542
+ }
1543
+ print(name = 'download', ignoreElementClass) {
1544
+ const root = this.root;
1545
+ const mainContainer = this.mainContainer;
1546
+ // set print width
1547
+ const printWidth = root.offsetWidth;
1548
+ // set print height
1549
+ const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
1550
+ html2canvas(root, {
1551
+ logging: false,
1552
+ allowTaint: true,
1553
+ useCORS: true,
1554
+ width: printWidth,
1555
+ height: printHeight,
1556
+ ignoreElements: (element) => {
1557
+ if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
1558
+ return true;
1559
+ }
1560
+ if (element.classList.contains('gantt-calendar-today-overlay')) {
1561
+ return true;
1562
+ }
1563
+ },
1564
+ onclone: (cloneDocument) => {
1565
+ const ganttClass = root.className;
1566
+ const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
1567
+ const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
1568
+ const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-overlay-main');
1569
+ const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
1570
+ // change targetDom width
1571
+ cloneGanttDom.style.width = `${printWidth}px`;
1572
+ cloneGanttDom.style.height = `${printHeight}px`;
1573
+ cloneGanttDom.style.overflow = `unset`;
1574
+ cloneGanttContainerDom.style.backgroundColor = '#fff';
1575
+ cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
1576
+ cloneCalendarOverlay.setAttribute('style', `background: transparent`);
1577
+ if (cloneLinksOverlay) {
1578
+ cloneLinksOverlay.setAttribute('height', `${printHeight}`);
1579
+ cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
1580
+ }
1581
+ // setInlineStyles for svg
1582
+ this.setInlineStyles(cloneGanttDom);
1637
1583
  }
1584
+ }).then((canvas) => {
1585
+ const link = document.createElement('a');
1586
+ const dataUrl = canvas.toDataURL('image/png');
1587
+ link.download = `${name}.png`;
1588
+ link.href = dataUrl;
1589
+ link.click();
1638
1590
  });
1639
- this.columnList = columns;
1640
- }
1641
- ngOnInit() { }
1642
- expandGroup(group) {
1643
- this.gantt.expandGroup(group);
1644
- }
1645
- expandChildren(item) {
1646
- this.gantt.expandChildren(item);
1647
- }
1648
- trackBy(item, index) {
1649
- return item.id || index;
1650
1591
  }
1651
1592
  }
1652
- GanttTableBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttTableBodyComponent, deps: [{ token: GANTT_ABSTRACT_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
1653
- GanttTableBodyComponentcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: { tempData: "tempData", columns: "columns", groupTemplate: "groupTemplate", emptyTemplate: "emptyTemplate" }, host: { properties: { "class.gantt-table-body": "this.ganttTableClass", "class.gantt-table-empty": "this.ganttTableEmptyClass" } }, ngImport: i0, template: "<div class=\"gantt-table-body-container\">\n <ng-container *ngIf=\"!flatData?.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=\"flatData && flatData.length > 0\">\n <ng-container *ngFor=\"let data of flatData; trackBy: trackBy\">\n <div class=\"gantt-table-group\" [ngClass]=\"data.class\" *ngIf=\"data.items\">\n <div class=\"gantt-table-group-title\" [class.expanded]=\"data.expanded\" (click)=\"expandGroup(data)\">\n <gantt-icon class=\"expand-icon\" [iconName]=\"data.expanded ? 'angle-down' : 'angle-right'\"></gantt-icon>\n <ng-container *ngIf=\"groupTemplate; else default\">\n <ng-template\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: data.origin, group: data.origin }\"\n ></ng-template>\n </ng-container>\n <ng-template #default>\n <span class=\"group-title\">{{ data.title }}</span>\n </ng-template>\n </div>\n </div>\n\n <div\n *ngIf=\"!data.items\"\n class=\"gantt-table-item gantt-table-row\"\n [class.gantt-table-item-with-group]=\"hasGroup\"\n [class.gantt-table-item-first-level-group]=\"data.level === 0 && (data.type | isGanttRangeItem)\"\n [style.height.px]=\"gantt.styles.lineHeight\"\n [style.lineHeight.px]=\"gantt.styles.lineHeight\"\n >\n <div class=\"gantt-table-column\" *ngFor=\"let column of columnList; let first = first\" [style.width]=\"column.columnWidth\">\n <div *ngIf=\"first\" class=\"gantt-expand-icon\" [style.marginLeft.px]=\"data.level * 20\">\n <ng-container *ngIf=\"data.level < gantt.maxLevel - 1 && data.expandable\">\n <gantt-icon\n *ngIf=\"!data.loading\"\n class=\"expand-icon\"\n [iconName]=\"data.expanded ? 'angle-down' : 'angle-right'\"\n (click)=\"expandChildren(data)\"\n ></gantt-icon>\n <gantt-icon *ngIf=\"data.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: data.origin, item: data.origin }\"\n ></ng-template>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n</div>\n", components: [{ type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "isGanttRangeItem": IsGanttRangeItemPipe } });
1654
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttTableBodyComponent, decorators: [{
1655
- type: Component,
1656
- args: [{
1657
- selector: 'gantt-table-body',
1658
- templateUrl: './gantt-table-body.component.html'
1659
- }]
1660
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1661
- type: Inject,
1662
- args: [GANTT_ABSTRACT_TOKEN]
1663
- }] }]; }, propDecorators: { tempData: [{
1664
- type: Input
1665
- }], columns: [{
1666
- type: Input
1667
- }], groupTemplate: [{
1668
- type: Input
1669
- }], emptyTemplate: [{
1670
- type: Input
1671
- }], ganttTableClass: [{
1672
- type: HostBinding,
1673
- args: ['class.gantt-table-body']
1674
- }], ganttTableEmptyClass: [{
1675
- type: HostBinding,
1676
- args: ['class.gantt-table-empty']
1677
- }] } });
1593
+ GanttPrintService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1594
+ GanttPrintServiceprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService });
1595
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttPrintService, decorators: [{
1596
+ type: Injectable
1597
+ }], ctorParameters: function () { return []; } });
1678
1598
 
1679
1599
  const mainHeight = 5000;
1680
- class GanttCalendarGridComponent {
1600
+ class GanttCalendarComponent {
1681
1601
  constructor(ganttUpper, ngZone, elementRef) {
1682
1602
  this.ganttUpper = ganttUpper;
1683
1603
  this.ngZone = ngZone;
@@ -1685,21 +1605,30 @@ class GanttCalendarGridComponent {
1685
1605
  this.unsubscribe$ = new Subject();
1686
1606
  this.headerHeight = headerHeight;
1687
1607
  this.mainHeight = mainHeight;
1608
+ this.todayHeight = todayHeight;
1609
+ this.todayWidth = todayWidth;
1688
1610
  this.todayBorderRadius = todayBorderRadius;
1689
1611
  this.viewTypes = GanttViewType;
1690
- this.className = `gantt-calendar gantt-calendar-grid`;
1612
+ this.className = true;
1691
1613
  }
1692
1614
  get view() {
1693
1615
  return this.ganttUpper.view;
1694
1616
  }
1695
1617
  setTodayPoint() {
1696
1618
  const x = this.view.getTodayXPoint();
1619
+ const today = new GanttDate().getDate();
1697
1620
  const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
1621
+ const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
1698
1622
  const line = this.elementRef.nativeElement.getElementsByClassName('today-line')[0];
1699
1623
  if (isNumber(x)) {
1624
+ if (rect) {
1625
+ rect.style.left = `${x - todayWidth / 2}px`;
1626
+ rect.style.top = `${headerHeight - todayHeight}px`;
1627
+ rect.innerHTML = today.toString();
1628
+ }
1700
1629
  if (line) {
1701
1630
  line.style.left = `${x}px`;
1702
- line.style.top = `0px`;
1631
+ line.style.top = `${headerHeight}px`;
1703
1632
  line.style.bottom = `${-mainHeight}px`;
1704
1633
  }
1705
1634
  }
@@ -1726,20 +1655,148 @@ class GanttCalendarGridComponent {
1726
1655
  this.unsubscribe$.complete();
1727
1656
  }
1728
1657
  }
1729
- GanttCalendarGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttCalendarGridComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1730
- GanttCalendarGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid", host: { properties: { "class": "this.className" } }, usesOnChanges: true, ngImport: i0, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n <span class=\"today-line\" *ngIf=\"ganttUpper.showTodayLine\"> </span>\n</div>\n\n<svg class=\"gantt-calendar-grid-main\" [attr.width]=\"view.width\" [attr.height]=\"headerHeight - 1\">\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]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n </g>\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 </g>\n</svg>\n", directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1731
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttCalendarGridComponent, decorators: [{
1658
+ 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 });
1659
+ 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"] }] });
1660
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttCalendarComponent, decorators: [{
1661
+ type: Component,
1662
+ args: [{
1663
+ selector: 'gantt-calendar-overlay',
1664
+ templateUrl: './calendar.component.html'
1665
+ }]
1666
+ }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
1667
+ type: Inject,
1668
+ args: [GANTT_UPPER_TOKEN]
1669
+ }] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
1670
+ type: HostBinding,
1671
+ args: ['class.gantt-calendar-overlay']
1672
+ }] } });
1673
+
1674
+ class GanttDragBackdropComponent {
1675
+ constructor() {
1676
+ this.backdropClass = true;
1677
+ }
1678
+ ngOnInit() { }
1679
+ }
1680
+ GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1681
+ 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" });
1682
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
1732
1683
  type: Component,
1733
1684
  args: [{
1734
- selector: 'gantt-calendar-grid',
1735
- templateUrl: './calendar-grid.component.html'
1685
+ selector: 'gantt-drag-backdrop',
1686
+ templateUrl: `./drag-backdrop.component.html`
1687
+ }]
1688
+ }], ctorParameters: function () { return []; }, propDecorators: { backdropClass: [{
1689
+ type: HostBinding,
1690
+ args: ['class.gantt-drag-backdrop']
1691
+ }] } });
1692
+
1693
+ class NgxGanttRootComponent {
1694
+ constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
1695
+ this.elementRef = elementRef;
1696
+ this.ngZone = ngZone;
1697
+ this.dom = dom;
1698
+ this.dragContainer = dragContainer;
1699
+ this.ganttUpper = ganttUpper;
1700
+ this.printService = printService;
1701
+ this.ganttClass = true;
1702
+ this.unsubscribe$ = new Subject();
1703
+ this.ganttUpper.dragContainer = dragContainer;
1704
+ }
1705
+ get view() {
1706
+ return this.ganttUpper.view;
1707
+ }
1708
+ ngOnInit() {
1709
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
1710
+ this.dom.initialize(this.elementRef);
1711
+ if (this.printService) {
1712
+ this.printService.register(this.elementRef);
1713
+ }
1714
+ this.setupScrollClass();
1715
+ this.setupResize();
1716
+ this.setupViewScroll();
1717
+ // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
1718
+ this.elementRef.nativeElement.style.opacity = '1';
1719
+ this.ganttUpper.viewChange.pipe(startWith(null)).subscribe(() => {
1720
+ this.scrollToToday();
1721
+ });
1722
+ });
1723
+ }
1724
+ setupViewScroll() {
1725
+ if (this.ganttUpper.disabledLoadOnScroll) {
1726
+ return;
1727
+ }
1728
+ this.dom
1729
+ .getViewerScroll()
1730
+ .pipe(takeUntil(this.unsubscribe$))
1731
+ .subscribe((event) => {
1732
+ if (event.direction === ScrollDirection.LEFT) {
1733
+ const dates = this.view.addStartDate();
1734
+ if (dates) {
1735
+ event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
1736
+ this.ngZone.run(() => {
1737
+ this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() });
1738
+ });
1739
+ }
1740
+ }
1741
+ if (event.direction === ScrollDirection.RIGHT) {
1742
+ const dates = this.view.addEndDate();
1743
+ if (dates) {
1744
+ this.ngZone.run(() => {
1745
+ this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() });
1746
+ });
1747
+ }
1748
+ }
1749
+ });
1750
+ }
1751
+ setupResize() {
1752
+ this.dom
1753
+ .getResize()
1754
+ .pipe(takeUntil(this.unsubscribe$))
1755
+ .subscribe(() => {
1756
+ this.setupScrollClass();
1757
+ });
1758
+ }
1759
+ setupScrollClass() {
1760
+ const mainContainer = this.dom.mainContainer;
1761
+ const height = mainContainer.offsetHeight;
1762
+ const scrollHeight = mainContainer.scrollHeight;
1763
+ if (scrollHeight > height) {
1764
+ this.elementRef.nativeElement.className = 'gantt gantt-scroll';
1765
+ }
1766
+ else {
1767
+ this.elementRef.nativeElement.className = 'gantt';
1768
+ }
1769
+ }
1770
+ scrollToToday() {
1771
+ const x = this.view.getTodayXPoint();
1772
+ this.dom.scrollMainContainer(x);
1773
+ }
1774
+ }
1775
+ 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 });
1776
+ 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"] }] });
1777
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
1778
+ type: Component,
1779
+ args: [{
1780
+ selector: 'ngx-gantt-root',
1781
+ templateUrl: './root.component.html',
1782
+ providers: [GanttDomService, GanttDragContainer]
1736
1783
  }]
1737
- }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
1784
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
1738
1785
  type: Inject,
1739
1786
  args: [GANTT_UPPER_TOKEN]
1740
- }] }, { type: i0.NgZone }, { type: i0.ElementRef }]; }, propDecorators: { className: [{
1787
+ }] }, { type: GanttPrintService, decorators: [{
1788
+ type: Optional
1789
+ }] }]; }, propDecorators: { sideWidth: [{
1790
+ type: Input
1791
+ }], ganttClass: [{
1741
1792
  type: HostBinding,
1742
- args: ['class']
1793
+ args: ['class.gantt']
1794
+ }], sideTemplate: [{
1795
+ type: ContentChild,
1796
+ args: ['sideTemplate', { static: true }]
1797
+ }], mainTemplate: [{
1798
+ type: ContentChild,
1799
+ args: ['mainTemplate', { static: true }]
1743
1800
  }] } });
1744
1801
 
1745
1802
  var LinkColors;
@@ -1754,7 +1811,8 @@ class GanttLinksComponent {
1754
1811
  this.cdr = cdr;
1755
1812
  this.elementRef = elementRef;
1756
1813
  this.ganttDragContainer = ganttDragContainer;
1757
- this.flatData = [];
1814
+ this.groups = [];
1815
+ this.items = [];
1758
1816
  this.lineClick = new EventEmitter();
1759
1817
  this.links = [];
1760
1818
  this.linkItems = [];
@@ -1764,8 +1822,8 @@ class GanttLinksComponent {
1764
1822
  this.ganttLinksOverlay = true;
1765
1823
  }
1766
1824
  ngOnInit() {
1767
- this.firstChange = false;
1768
1825
  this.buildLinks();
1826
+ this.firstChange = false;
1769
1827
  this.ganttDragContainer.dragStarted.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
1770
1828
  this.elementRef.nativeElement.style.visibility = 'hidden';
1771
1829
  });
@@ -1786,21 +1844,40 @@ class GanttLinksComponent {
1786
1844
  const lineHeight = this.ganttUpper.styles.lineHeight;
1787
1845
  const barHeight = this.ganttUpper.styles.barHeight;
1788
1846
  this.linkItems = [];
1789
- this.flatData.forEach((item, itemIndex) => {
1790
- if (!item.hasOwnProperty('items')) {
1791
- const ganttItem = item;
1792
- if (ganttItem.refs) {
1793
- const y = itemIndex * lineHeight + ganttItem.refs.y + barHeight / 2;
1794
- this.linkItems.push(Object.assign(Object.assign({}, ganttItem), { before: {
1795
- x: ganttItem.refs.x,
1796
- y
1797
- }, after: {
1798
- x: ganttItem.refs.x + ganttItem.refs.width,
1799
- y
1800
- } }));
1847
+ if (this.groups.length > 0) {
1848
+ let itemNum = 0;
1849
+ let groupNum = 0;
1850
+ this.groups.forEach((group) => {
1851
+ groupNum++;
1852
+ if (group.expanded) {
1853
+ const items = recursiveItems(group.items);
1854
+ items.forEach((item, itemIndex) => {
1855
+ const y = (groupNum + itemNum + itemIndex) * lineHeight + item.refs.y + barHeight / 2;
1856
+ this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
1857
+ x: item.refs.x,
1858
+ y
1859
+ }, after: {
1860
+ x: item.refs.x + item.refs.width,
1861
+ y
1862
+ } }));
1863
+ });
1864
+ itemNum += items.length;
1801
1865
  }
1802
- }
1803
- });
1866
+ });
1867
+ }
1868
+ else {
1869
+ const items = recursiveItems(this.items);
1870
+ items.forEach((item, itemIndex) => {
1871
+ const y = itemIndex * lineHeight + item.refs.y + barHeight / 2;
1872
+ this.linkItems.push(Object.assign(Object.assign({}, item), { before: {
1873
+ x: item.refs.x,
1874
+ y
1875
+ }, after: {
1876
+ x: item.refs.x + item.refs.width,
1877
+ y
1878
+ } }));
1879
+ });
1880
+ }
1804
1881
  }
1805
1882
  generatePath(source, target) {
1806
1883
  if (source.before && source.after && target.before && target.after) {
@@ -1905,7 +1982,7 @@ class GanttLinksComponent {
1905
1982
  }
1906
1983
  }
1907
1984
  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 });
1908
- GanttLinksComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: { flatData: "flatData" }, 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 [attr.d]=\"link.path\" fill=\"transparent\" stroke-width=\"2\" [attr.stroke]=\"link.color\" pointer-events=\"none\"></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 </ng-container>\n <line class=\"link-dragging-line\"></line>\n</svg>\n", directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1985
+ 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 [attr.d]=\"link.path\" fill=\"transparent\" stroke-width=\"2\" [attr.stroke]=\"link.color\" pointer-events=\"none\"></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 </ng-container>\n <line class=\"link-dragging-line\"></line>\n</svg>\n", directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
1909
1986
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttLinksComponent, decorators: [{
1910
1987
  type: Component,
1911
1988
  args: [{
@@ -1915,7 +1992,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
1915
1992
  }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
1916
1993
  type: Inject,
1917
1994
  args: [GANTT_UPPER_TOKEN]
1918
- }] }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: GanttDragContainer }]; }, propDecorators: { flatData: [{
1995
+ }] }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: GanttDragContainer }]; }, propDecorators: { groups: [{
1996
+ type: Input
1997
+ }], items: [{
1919
1998
  type: Input
1920
1999
  }], lineClick: [{
1921
2000
  type: Output
@@ -1943,11 +2022,10 @@ class GanttItemUpper {
1943
2022
  }
1944
2023
  }
1945
2024
  setPositions() {
1946
- var _a, _b, _c;
1947
2025
  const itemElement = this.elementRef.nativeElement;
1948
- itemElement.style.left = ((_a = this.item.refs) === null || _a === void 0 ? void 0 : _a.x) + 'px';
1949
- itemElement.style.top = ((_b = this.item.refs) === null || _b === void 0 ? void 0 : _b.y) + 'px';
1950
- itemElement.style.width = ((_c = this.item.refs) === null || _c === void 0 ? void 0 : _c.width) + 'px';
2026
+ itemElement.style.left = this.item.refs.x + 'px';
2027
+ itemElement.style.top = this.item.refs.y + 'px';
2028
+ itemElement.style.width = this.item.refs.width + 'px';
1951
2029
  if (this.item.type === GanttItemType.bar) {
1952
2030
  itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
1953
2031
  }
@@ -1991,7 +2069,7 @@ class NgxGanttRangeComponent extends GanttItemUpper {
1991
2069
  }
1992
2070
  }
1993
2071
  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 });
1994
- 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: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2072
+ 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"] }] });
1995
2073
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
1996
2074
  type: Component,
1997
2075
  args: [{
@@ -2256,11 +2334,11 @@ class GanttBarDrag {
2256
2334
  this.destroy$.complete();
2257
2335
  }
2258
2336
  }
2259
- GanttBarDrag.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttBarDrag, deps: [{ token: i1$1.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }], target: i0.ɵɵFactoryTarget.Injectable });
2337
+ 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 });
2260
2338
  GanttBarDrag.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttBarDrag });
2261
2339
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttBarDrag, decorators: [{
2262
2340
  type: Injectable
2263
- }], ctorParameters: function () { return [{ type: i1$1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }]; } });
2341
+ }], ctorParameters: function () { return [{ type: i1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }]; } });
2264
2342
 
2265
2343
  function linearGradient(sideOrCorner, color, stop) {
2266
2344
  return `linear-gradient(${sideOrCorner},${color} 0%,${stop} 40%)`;
@@ -2327,7 +2405,7 @@ class NgxGanttBarComponent extends GanttItemUpper {
2327
2405
  }
2328
2406
  }
2329
2407
  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 });
2330
- 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: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2408
+ 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"] }] });
2331
2409
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttBarComponent, decorators: [{
2332
2410
  type: Component,
2333
2411
  args: [{
@@ -2361,7 +2439,7 @@ class GanttMainComponent {
2361
2439
  }
2362
2440
  }
2363
2441
  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 });
2364
- GanttMainComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttMainComponent, selector: "gantt-main", inputs: { tempData: "tempData", flatData: "flatData", 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 [flatData]=\"flatData\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n\n<div class=\"gantt-main-groups\" *ngIf=\"tempData && tempData.length > 0\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let data of tempData; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"data.class\" *ngIf=\"data.items\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: data }\"></ng-template>\n </div>\n <div class=\"gantt-item\" [style.height.px]=\"ganttUpper.styles.lineHeight\" *ngIf=\"!data.items\">\n <ng-container *ngIf=\"data.type | isGanttCustomItem\">\n <ng-template [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{ item: data.origin, refs: data.refs }\"></ng-template>\n </ng-container>\n <gantt-range *ngIf=\"data.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"data\"></gantt-range>\n <gantt-bar *ngIf=\"data.type | isGanttBarItem\" [item]=\"data\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n </div>\n </ng-container>\n</div>\n", components: [{ type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: ["flatData"], outputs: ["lineClick"] }, { type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range" }, { type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: ["barClick"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "isGanttCustomItem": IsGanttCustomItemPipe, "isGanttRangeItem": IsGanttRangeItemPipe, "isGanttBarItem": IsGanttBarItemPipe } });
2442
+ GanttMainComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: GanttMainComponent, selector: "gantt-main", inputs: { groups: "groups", items: "items", groupHeaderTemplate: "groupHeaderTemplate", itemTemplate: "itemTemplate", barTemplate: "barTemplate", rangeTemplate: "rangeTemplate" }, outputs: { barClick: "barClick", lineClick: "lineClick" }, host: { properties: { "class.gantt-main-container": "this.ganttMainClass" } }, ngImport: i0, template: "<gantt-links-overlay [groups]=\"groups\" [items]=\"items\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<!-- groups -->\n<div class=\"gantt-main-groups\" *ngIf=\"groups && groups.length > 0; else itemsTemplate\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-container *ngFor=\"let group of groups; trackBy: trackBy\">\n <div class=\"gantt-group\" [ngClass]=\"group.class\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: group }\"></ng-template>\n </div>\n <div *ngIf=\"group.expanded\" class=\"gantt-items\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: group.items }\"></ng-template>\n </div>\n </ng-container>\n</div>\n<!-- items -->\n<ng-template #itemsTemplate>\n <div class=\"gantt-main-items\" [style.width.px]=\"ganttUpper.view.width\">\n <ng-template [ngTemplateOutlet]=\"ganttItems\" [ngTemplateOutletContext]=\"{ items: items }\"></ng-template>\n </div>\n</ng-template>\n\n<ng-template #ganttItems let-items=\"items\">\n <ng-container *ngFor=\"let item of items; trackBy: trackBy\">\n <div class=\"gantt-item\" [style.height.px]=\"ganttUpper.styles.lineHeight\">\n <ng-container *ngIf=\"item.type | isGanttCustomItem\">\n <ng-template [ngTemplateOutlet]=\"itemTemplate\" [ngTemplateOutletContext]=\"{ item: item.origin, refs: item.refs }\"></ng-template>\n </ng-container>\n <gantt-range *ngIf=\"item.type | isGanttRangeItem\" [template]=\"rangeTemplate\" [item]=\"item\"></gantt-range>\n <gantt-bar *ngIf=\"item.type | isGanttBarItem\" [item]=\"item\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n </div>\n <ng-template\n *ngIf=\"item.children && item.expanded\"\n [ngTemplateOutlet]=\"ganttItems\"\n [ngTemplateOutletContext]=\"{ items: item.children }\"\n ></ng-template>\n </ng-container>\n</ng-template>\n", components: [{ type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: ["groups", "items"], outputs: ["lineClick"] }, { type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range" }, { type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: ["barClick"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "isGanttCustomItem": IsGanttCustomItemPipe, "isGanttRangeItem": IsGanttRangeItemPipe, "isGanttBarItem": IsGanttBarItemPipe } });
2365
2443
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttMainComponent, decorators: [{
2366
2444
  type: Component,
2367
2445
  args: [{
@@ -2371,9 +2449,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2371
2449
  }], ctorParameters: function () { return [{ type: GanttUpper, decorators: [{
2372
2450
  type: Inject,
2373
2451
  args: [GANTT_UPPER_TOKEN]
2374
- }] }]; }, propDecorators: { tempData: [{
2452
+ }] }]; }, propDecorators: { groups: [{
2375
2453
  type: Input
2376
- }], flatData: [{
2454
+ }], items: [{
2377
2455
  type: Input
2378
2456
  }], groupHeaderTemplate: [{
2379
2457
  type: Input
@@ -2392,58 +2470,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2392
2470
  args: ['class.gantt-main-container']
2393
2471
  }] } });
2394
2472
 
2395
- class GanttDragBackdropComponent {
2396
- constructor() {
2397
- this.backdropClass = true;
2398
- }
2399
- ngOnInit() { }
2400
- }
2401
- GanttDragBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2402
- 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" });
2403
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
2404
- type: Component,
2405
- args: [{
2406
- selector: 'gantt-drag-backdrop',
2407
- templateUrl: `./drag-backdrop.component.html`
2408
- }]
2409
- }], ctorParameters: function () { return []; }, propDecorators: { backdropClass: [{
2410
- type: HostBinding,
2411
- args: ['class.gantt-drag-backdrop']
2412
- }] } });
2413
-
2414
2473
  class NgxGanttComponent extends GanttUpper {
2415
- constructor(elementRef, cdr, ngZone, dom, dragContainer, printService) {
2416
- super(elementRef, cdr, ngZone);
2417
- this.dom = dom;
2418
- this.dragContainer = dragContainer;
2419
- this.printService = printService;
2474
+ constructor(elementRef, cdr, ngZone, config) {
2475
+ super(elementRef, cdr, ngZone, config);
2420
2476
  this.maxLevel = 2;
2421
2477
  this.linkDragStarted = new EventEmitter();
2422
2478
  this.linkDragEnded = new EventEmitter();
2423
2479
  this.lineClick = new EventEmitter();
2424
- this.flatData = [];
2425
- this.tempData = [];
2426
2480
  this.ngUnsubscribe$ = new Subject();
2427
- this.dragContainer = dragContainer;
2428
- this.computeAllRefs = false;
2481
+ this.sideTableWidth = sideWidth;
2429
2482
  }
2430
2483
  ngOnInit() {
2431
2484
  super.onInit();
2432
- this.buildVirtualFlatData();
2433
2485
  this.ngZone.onStable.pipe(take(1)).subscribe(() => {
2434
- this.dom.initialize(this.elementRef);
2435
- if (this.printService) {
2436
- this.printService.register(this.elementRef);
2437
- }
2438
- this.setupViewScroll();
2439
- // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2440
- this.elementRef.nativeElement.style.opacity = '1';
2441
- this.viewChange.pipe(startWith(null)).subscribe(() => {
2442
- this.scrollToToday();
2443
- });
2444
- this.dragContainer.dragEnded.subscribe((event) => {
2445
- this.computeTempDataRefs();
2446
- });
2447
2486
  this.dragContainer.linkDragStarted.pipe(takeUntil(this.ngUnsubscribe$)).subscribe((event) => {
2448
2487
  this.linkDragStarted.emit(event);
2449
2488
  });
@@ -2451,9 +2490,6 @@ class NgxGanttComponent extends GanttUpper {
2451
2490
  this.linkDragEnded.emit(event);
2452
2491
  });
2453
2492
  });
2454
- this.view.start$.pipe(skip(1), takeUntil(this.unsubscribe$)).subscribe(() => {
2455
- this.computeTempDataRefs();
2456
- });
2457
2493
  }
2458
2494
  ngAfterViewInit() {
2459
2495
  this.columns.changes.pipe(startWith(true), takeUntil(this.ngUnsubscribe$)).subscribe(() => {
@@ -2464,40 +2500,9 @@ class NgxGanttComponent extends GanttUpper {
2464
2500
  });
2465
2501
  this.cdr.detectChanges();
2466
2502
  });
2467
- this.virtualScroll.renderedRangeStream.subscribe((range) => {
2468
- const linksElement = this.elementRef.nativeElement.querySelector('.gantt-links-overlay');
2469
- linksElement.style.top = `${-(this.styles.lineHeight * range.start)}px`;
2470
- this.rangeStart = range.start;
2471
- this.rangeEnd = range.end;
2472
- this.tempData = this.flatData.slice(range.start, range.end);
2473
- this.computeTempDataRefs();
2474
- });
2475
2503
  }
2476
2504
  ngOnChanges(changes) {
2477
2505
  super.onChanges(changes);
2478
- if (!this.firstChange) {
2479
- if (changes.viewType && changes.viewType.currentValue) {
2480
- this.tempData = this.flatData.slice(this.rangeStart, this.rangeEnd);
2481
- this.computeTempDataRefs();
2482
- }
2483
- if (changes.originItems || changes.originGroups) {
2484
- this.buildVirtualFlatData();
2485
- this.tempData = this.flatData.slice(this.rangeStart, this.rangeEnd);
2486
- this.computeTempDataRefs();
2487
- }
2488
- }
2489
- }
2490
- expandGroup(group) {
2491
- group.setExpand(!group.expanded);
2492
- this.afterExpand();
2493
- this.expandChange.emit();
2494
- this.cdr.detectChanges();
2495
- }
2496
- expandAll() {
2497
- this.expandGroups(true);
2498
- }
2499
- collapseAll() {
2500
- this.expandGroups(false);
2501
2506
  }
2502
2507
  expandChildren(item) {
2503
2508
  if (!item.expanded) {
@@ -2507,7 +2512,6 @@ class NgxGanttComponent extends GanttUpper {
2507
2512
  this.childrenResolve(item.origin)
2508
2513
  .pipe(take(1), finalize(() => {
2509
2514
  item.loading = false;
2510
- this.afterExpand();
2511
2515
  this.expandChange.emit();
2512
2516
  this.cdr.detectChanges();
2513
2517
  }))
@@ -2518,107 +2522,20 @@ class NgxGanttComponent extends GanttUpper {
2518
2522
  }
2519
2523
  else {
2520
2524
  this.computeItemsRefs(...item.children);
2521
- this.afterExpand();
2522
2525
  this.expandChange.emit();
2523
2526
  }
2524
2527
  }
2525
2528
  else {
2526
2529
  item.setExpand(false);
2527
- this.afterExpand();
2528
2530
  this.expandChange.emit();
2529
2531
  }
2530
2532
  }
2531
- buildVirtualFlatData() {
2532
- const virtualData = [];
2533
- if (this.groups.length) {
2534
- this.groups.forEach((group) => {
2535
- virtualData.push(group);
2536
- if (group.expanded) {
2537
- const items = recursiveItems(group.items, 0);
2538
- virtualData.push(...items);
2539
- }
2540
- });
2541
- }
2542
- if (this.items.length) {
2543
- virtualData.push(...recursiveItems(this.items, 0));
2544
- }
2545
- this.flatData = [...virtualData];
2546
- this.flatDataMap = keyBy(this.flatData, 'id');
2547
- }
2548
- afterExpand() {
2549
- this.buildVirtualFlatData();
2550
- this.tempData = this.flatData.slice(this.rangeStart, this.rangeEnd);
2551
- }
2552
- trackBy(item, index) {
2553
- return item.id || index;
2554
- }
2555
- scrollToToday() {
2556
- const x = this.view.getTodayXPoint();
2557
- this.dom.scrollMainContainer(x);
2558
- }
2559
- setupViewScroll() {
2560
- if (this.disabledLoadOnScroll) {
2561
- return;
2562
- }
2563
- this.dom
2564
- .getViewerScroll()
2565
- .pipe(takeUntil(this.unsubscribe$))
2566
- .subscribe((event) => {
2567
- if (event.direction === ScrollDirection.LEFT) {
2568
- const dates = this.view.addStartDate();
2569
- if (dates) {
2570
- event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
2571
- this.ngZone.run(() => {
2572
- this.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() });
2573
- });
2574
- }
2575
- }
2576
- if (event.direction === ScrollDirection.RIGHT) {
2577
- const dates = this.view.addEndDate();
2578
- if (dates) {
2579
- this.ngZone.run(() => {
2580
- this.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() });
2581
- });
2582
- }
2583
- }
2584
- this.cdr.detectChanges();
2585
- });
2586
- }
2587
- expandGroups(expanded) {
2588
- this.groups.forEach((group) => {
2589
- group.setExpand(expanded);
2590
- });
2591
- this.afterExpand();
2592
- this.expandChange.next();
2593
- this.cdr.detectChanges();
2594
- }
2595
- computeTempDataRefs() {
2596
- const tempItemData = [];
2597
- this.tempData.forEach((data) => {
2598
- if (!data.hasOwnProperty('items')) {
2599
- const item = data;
2600
- if (item.links) {
2601
- item.links.forEach((link) => {
2602
- if (this.flatDataMap[link]) {
2603
- tempItemData.push(this.flatDataMap[link]);
2604
- }
2605
- });
2606
- }
2607
- tempItemData.push(data);
2608
- }
2609
- });
2610
- this.computeItemsRefs(...uniqBy(tempItemData, 'id'));
2611
- this.flatData = [...this.flatData];
2612
- this.tempData = [...this.tempData];
2613
- }
2614
2533
  ngOnDestroy() {
2615
2534
  super.onDestroy();
2616
2535
  }
2617
2536
  }
2618
- 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: GanttDomService }, { token: GanttDragContainer }, { token: GanttPrintService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2537
+ 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 });
2619
2538
  NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.2", type: NgxGanttComponent, selector: "ngx-gantt", inputs: { maxLevel: "maxLevel", async: "async", childrenResolve: "childrenResolve", linkable: "linkable" }, outputs: { linkDragStarted: "linkDragStarted", linkDragEnded: "linkDragEnded", lineClick: "lineClick" }, providers: [
2620
- GanttDomService,
2621
- GanttDragContainer,
2622
2539
  {
2623
2540
  provide: GANTT_UPPER_TOKEN,
2624
2541
  useExisting: NgxGanttComponent
@@ -2627,7 +2544,7 @@ NgxGanttComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
2627
2544
  provide: GANTT_ABSTRACT_TOKEN,
2628
2545
  useExisting: forwardRef(() => NgxGanttComponent)
2629
2546
  }
2630
- ], 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 }], viewQueries: [{ propertyName: "virtualScroll", first: true, predicate: CdkVirtualScrollViewport, descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header></gantt-calendar-header>\n </div>\n</div>\n\n<cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n>\n <ng-container *cdkVirtualFor=\"let item of flatData; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth\">\n <div class=\"gantt-side-container\">\n <gantt-table-body\n [tempData]=\"tempData\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"tableEmptyTemplate\"\n ></gantt-table-body>\n </div>\n </div>\n <div class=\"gantt-container\">\n <gantt-calendar-grid></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n [tempData]=\"tempData\"\n [flatData]=\"flatData\"\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 </div>\n </div>\n</cdk-virtual-scroll-viewport>\n\n<gantt-drag-backdrop [style.left.px]=\"tableHeader.tableWidth\"></gantt-drag-backdrop>\n", components: [{ type: GanttTableHeaderComponent, selector: "gantt-table-header", inputs: ["columns"] }, { type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header" }, { type: i6.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: ["tempData", "columns", "groupTemplate", "emptyTemplate"] }, { type: GanttCalendarGridComponent, selector: "gantt-calendar-grid" }, { type: GanttMainComponent, selector: "gantt-main", inputs: ["tempData", "flatData", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }, { type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }], directives: [{ type: i6.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { type: i6.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2547
+ ], 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 [groups]=\"groups\" [items]=\"items\" [columns]=\"columns\" [groupTemplate]=\"groupTemplate\" [emptyTemplate]=\"tableEmptyTemplate\"></gantt-table>\n </ng-template>\n <ng-template #mainTemplate>\n <gantt-main\n [groups]=\"groups\"\n [items]=\"items\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n (barClick)=\"barClick.emit($event)\"\n (lineClick)=\"lineClick.emit($event)\"\n >\n </gantt-main>\n </ng-template>\n</ngx-gantt-root>\n", components: [{ type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }, { type: GanttTableComponent, selector: "gantt-table", inputs: ["groups", "items", "columns", "groupTemplate", "emptyTemplate"] }, { type: GanttMainComponent, selector: "gantt-main", inputs: ["groups", "items", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate"], outputs: ["barClick", "lineClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2631
2548
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttComponent, decorators: [{
2632
2549
  type: Component,
2633
2550
  args: [{
@@ -2635,8 +2552,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2635
2552
  templateUrl: './gantt.component.html',
2636
2553
  changeDetection: ChangeDetectionStrategy.OnPush,
2637
2554
  providers: [
2638
- GanttDomService,
2639
- GanttDragContainer,
2640
2555
  {
2641
2556
  provide: GANTT_UPPER_TOKEN,
2642
2557
  useExisting: NgxGanttComponent
@@ -2647,8 +2562,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2647
2562
  }
2648
2563
  ]
2649
2564
  }]
2650
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttPrintService, decorators: [{
2651
- type: Optional
2565
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
2566
+ type: Inject,
2567
+ args: [GANTT_GLOBAL_CONFIG]
2652
2568
  }] }]; }, propDecorators: { maxLevel: [{
2653
2569
  type: Input
2654
2570
  }], async: [{
@@ -2672,118 +2588,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2672
2588
  }], tableEmptyTemplate: [{
2673
2589
  type: ContentChild,
2674
2590
  args: ['tableEmpty', { static: true }]
2675
- }], virtualScroll: [{
2676
- type: ViewChild,
2677
- args: [CdkVirtualScrollViewport]
2678
- }] } });
2679
-
2680
- class NgxGanttRootComponent {
2681
- constructor(elementRef, ngZone, dom, dragContainer, ganttUpper, printService) {
2682
- this.elementRef = elementRef;
2683
- this.ngZone = ngZone;
2684
- this.dom = dom;
2685
- this.dragContainer = dragContainer;
2686
- this.ganttUpper = ganttUpper;
2687
- this.printService = printService;
2688
- this.ganttClass = true;
2689
- this.unsubscribe$ = new Subject();
2690
- this.ganttUpper.dragContainer = dragContainer;
2691
- }
2692
- get view() {
2693
- return this.ganttUpper.view;
2694
- }
2695
- ngOnInit() {
2696
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
2697
- this.dom.initialize(this.elementRef);
2698
- if (this.printService) {
2699
- this.printService.register(this.elementRef);
2700
- }
2701
- this.setupScrollClass();
2702
- this.setupResize();
2703
- this.setupViewScroll();
2704
- // 优化初始化时Scroll滚动体验问题,通过透明度解决,默认透明度为0,滚动结束后恢复
2705
- this.elementRef.nativeElement.style.opacity = '1';
2706
- this.ganttUpper.viewChange.pipe(startWith(null)).subscribe(() => {
2707
- this.scrollToToday();
2708
- });
2709
- });
2710
- }
2711
- setupViewScroll() {
2712
- if (this.ganttUpper.disabledLoadOnScroll) {
2713
- return;
2714
- }
2715
- this.dom
2716
- .getViewerScroll()
2717
- .pipe(takeUntil(this.unsubscribe$))
2718
- .subscribe((event) => {
2719
- if (event.direction === ScrollDirection.LEFT) {
2720
- const dates = this.view.addStartDate();
2721
- if (dates) {
2722
- event.target.scrollLeft += this.view.getDateRangeWidth(dates.start, dates.end);
2723
- this.ngZone.run(() => {
2724
- this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() });
2725
- });
2726
- }
2727
- }
2728
- if (event.direction === ScrollDirection.RIGHT) {
2729
- const dates = this.view.addEndDate();
2730
- if (dates) {
2731
- this.ngZone.run(() => {
2732
- this.ganttUpper.loadOnScroll.emit({ start: dates.start.getUnixTime(), end: dates.end.getUnixTime() });
2733
- });
2734
- }
2735
- }
2736
- });
2737
- }
2738
- setupResize() {
2739
- this.dom
2740
- .getResize()
2741
- .pipe(takeUntil(this.unsubscribe$))
2742
- .subscribe(() => {
2743
- this.setupScrollClass();
2744
- });
2745
- }
2746
- setupScrollClass() {
2747
- const mainContainer = this.dom.mainContainer;
2748
- const height = mainContainer.offsetHeight;
2749
- const scrollHeight = mainContainer.scrollHeight;
2750
- if (scrollHeight > height) {
2751
- this.elementRef.nativeElement.className = 'gantt gantt-scroll';
2752
- }
2753
- else {
2754
- this.elementRef.nativeElement.className = 'gantt';
2755
- }
2756
- }
2757
- scrollToToday() {
2758
- const x = this.view.getTodayXPoint();
2759
- this.dom.scrollMainContainer(x);
2760
- }
2761
- }
2762
- 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 });
2763
- 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-header></gantt-calendar-header>\n <gantt-calendar-grid></gantt-calendar-grid>\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: GanttCalendarHeaderComponent, selector: "gantt-calendar-header" }, { type: GanttCalendarGridComponent, selector: "gantt-calendar-grid" }, { type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }], directives: [{ type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
2764
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttRootComponent, decorators: [{
2765
- type: Component,
2766
- args: [{
2767
- selector: 'ngx-gantt-root',
2768
- templateUrl: './root.component.html',
2769
- providers: [GanttDomService, GanttDragContainer]
2770
- }]
2771
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: GanttDomService }, { type: GanttDragContainer }, { type: GanttUpper, decorators: [{
2772
- type: Inject,
2773
- args: [GANTT_UPPER_TOKEN]
2774
- }] }, { type: GanttPrintService, decorators: [{
2775
- type: Optional
2776
- }] }]; }, propDecorators: { sideWidth: [{
2777
- type: Input
2778
- }], ganttClass: [{
2779
- type: HostBinding,
2780
- args: ['class.gantt']
2781
- }], sideTemplate: [{
2782
- type: ContentChild,
2783
- args: ['sideTemplate', { static: true }]
2784
- }], mainTemplate: [{
2785
- type: ContentChild,
2786
- args: ['mainTemplate', { static: true }]
2787
2591
  }] } });
2788
2592
 
2789
2593
  class NgxGanttModule {
@@ -2792,11 +2596,9 @@ NgxGanttModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version:
2792
2596
  NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, declarations: [NgxGanttComponent,
2793
2597
  NgxGanttTableComponent,
2794
2598
  NgxGanttTableColumnComponent,
2795
- GanttTableHeaderComponent,
2796
- GanttTableBodyComponent,
2599
+ GanttTableComponent,
2797
2600
  GanttMainComponent,
2798
- GanttCalendarHeaderComponent,
2799
- GanttCalendarGridComponent,
2601
+ GanttCalendarComponent,
2800
2602
  GanttLinksComponent,
2801
2603
  NgxGanttBarComponent,
2802
2604
  GanttIconComponent,
@@ -2805,17 +2607,22 @@ NgxGanttModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version:
2805
2607
  NgxGanttRootComponent,
2806
2608
  IsGanttRangeItemPipe,
2807
2609
  IsGanttBarItemPipe,
2808
- IsGanttCustomItemPipe], imports: [CommonModule, DragDropModule, ScrollingModule], exports: [NgxGanttComponent,
2610
+ IsGanttCustomItemPipe], imports: [CommonModule, DragDropModule], exports: [NgxGanttComponent,
2809
2611
  NgxGanttTableComponent,
2810
2612
  NgxGanttTableColumnComponent,
2811
2613
  NgxGanttRootComponent,
2812
2614
  NgxGanttBarComponent,
2813
2615
  NgxGanttRangeComponent] });
2814
- NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, providers: [CdkVirtualScrollViewport], imports: [[CommonModule, DragDropModule, ScrollingModule]] });
2616
+ NgxGanttModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, providers: [
2617
+ {
2618
+ provide: GANTT_GLOBAL_CONFIG,
2619
+ useValue: defaultConfig
2620
+ }
2621
+ ], imports: [[CommonModule, DragDropModule]] });
2815
2622
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImport: i0, type: NgxGanttModule, decorators: [{
2816
2623
  type: NgModule,
2817
2624
  args: [{
2818
- imports: [CommonModule, DragDropModule, ScrollingModule],
2625
+ imports: [CommonModule, DragDropModule],
2819
2626
  exports: [
2820
2627
  NgxGanttComponent,
2821
2628
  NgxGanttTableComponent,
@@ -2828,11 +2635,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2828
2635
  NgxGanttComponent,
2829
2636
  NgxGanttTableComponent,
2830
2637
  NgxGanttTableColumnComponent,
2831
- GanttTableHeaderComponent,
2832
- GanttTableBodyComponent,
2638
+ GanttTableComponent,
2833
2639
  GanttMainComponent,
2834
- GanttCalendarHeaderComponent,
2835
- GanttCalendarGridComponent,
2640
+ GanttCalendarComponent,
2836
2641
  GanttLinksComponent,
2837
2642
  NgxGanttBarComponent,
2838
2643
  GanttIconComponent,
@@ -2843,7 +2648,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2843
2648
  IsGanttBarItemPipe,
2844
2649
  IsGanttCustomItemPipe
2845
2650
  ],
2846
- providers: [CdkVirtualScrollViewport]
2651
+ providers: [
2652
+ {
2653
+ provide: GANTT_GLOBAL_CONFIG,
2654
+ useValue: defaultConfig
2655
+ }
2656
+ ]
2847
2657
  }]
2848
2658
  }] });
2849
2659
 
@@ -2855,5 +2665,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.2", ngImpor
2855
2665
  * Generated bundle index. Do not edit.
2856
2666
  */
2857
2667
 
2858
- export { GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttDate, GanttDatePoint, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLoadOnScrollEvent, GanttPrintService, GanttTableEvent, GanttUpper, GanttView, GanttViewType, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttRangeItemPipe, NgxGanttBarComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, primaryDatePointTop, secondaryDatePointTop };
2668
+ export { GANTT_GLOBAL_CONFIG, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttDate, GanttDatePoint, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLoadOnScrollEvent, GanttPrintService, GanttTableEvent, GanttUpper, GanttView, GanttViewType, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttRangeItemPipe, NgxGanttBarComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, defaultConfig, primaryDatePointTop, secondaryDatePointTop };
2859
2669
  //# sourceMappingURL=worktile-gantt.js.map