@worktile/gantt 19.0.7 → 19.0.8-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,18 @@
1
- import * as i1 from '@angular/cdk/drag-drop';
2
- import { CdkDrag, CdkDropList, CdkDragHandle, DragDropModule } from '@angular/cdk/drag-drop';
3
- import * as i1$1 from '@angular/cdk/scrolling';
4
- import { CdkScrollable, CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, ScrollingModule } from '@angular/cdk/scrolling';
1
+ import { fromUnixTime, getWeek, getDaysInMonth, differenceInCalendarDays, setDate, addSeconds, addMinutes, addHours, addDays, addWeeks, addMonths, addQuarters, addYears, startOfMinute, startOfHour, startOfDay, startOfWeek, startOfMonth, startOfQuarter, startOfYear, endOfMinute, endOfHour, endOfDay, endOfWeek, endOfMonth, endOfQuarter, endOfYear, getUnixTime, format, isWeekend, isToday, setDefaultOptions, differenceInHours, differenceInMinutes, differenceInDays, eachWeekOfInterval, eachDayOfInterval, eachHourOfInterval, differenceInCalendarQuarters, eachMonthOfInterval, eachYearOfInterval, differenceInCalendarYears } from 'date-fns';
2
+ export { addDays, addHours, addMinutes, addMonths, addQuarters, addSeconds, addWeeks, addYears, differenceInCalendarDays, differenceInCalendarQuarters, differenceInDays, differenceInMinutes, eachDayOfInterval, eachHourOfInterval, eachMonthOfInterval, eachWeekOfInterval, endOfDay, endOfHour, endOfMinute, endOfMonth, endOfQuarter, endOfWeek, endOfYear, format, fromUnixTime, getDaysInMonth, getUnixTime, getWeek, isToday, isWeekend, setDate, startOfDay, startOfHour, startOfMinute, startOfMonth, startOfQuarter, startOfWeek, startOfYear } from 'date-fns';
3
+ import { TZDate } from '@date-fns/tz';
4
+ import { BehaviorSubject, Subject, from, fromEvent, Observable, merge, EMPTY, interval, animationFrameScheduler, takeUntil as takeUntil$1, take as take$1, combineLatest, startWith as startWith$1, auditTime as auditTime$1, filter } from 'rxjs';
5
5
  import { isPlatformServer, NgTemplateOutlet, NgStyle, NgClass, DOCUMENT, CommonModule } from '@angular/common';
6
6
  import * as i0 from '@angular/core';
7
- import { InjectionToken, inject, Inject, Injectable, EventEmitter, HostBinding, ContentChild, Output, Input, Directive, signal, PLATFORM_ID, effect, ViewChildren, ViewChild, Component, Pipe, NgZone, input, ElementRef, HostListener, Optional, forwardRef, ContentChildren, ChangeDetectionStrategy, NgModule } from '@angular/core';
8
- import { BehaviorSubject, Subject, from, fromEvent, Observable, merge, EMPTY, interval, animationFrameScheduler, take as take$1, takeUntil as takeUntil$1, combineLatest, startWith as startWith$1, auditTime as auditTime$1, filter } from 'rxjs';
7
+ import { InjectionToken, inject, Inject, Injectable, EventEmitter, HostBinding, ContentChild, Output, Input, Directive, signal, PLATFORM_ID, effect, ViewChildren, ViewChild, Component, NgZone, input, ElementRef, Pipe, HostListener, Optional, forwardRef, ContentChildren, ChangeDetectionStrategy, NgModule } from '@angular/core';
9
8
  import { take, takeUntil, skip, map, pairwise, auditTime, startWith, switchMap, debounceTime, finalize } from 'rxjs/operators';
10
- import { fromUnixTime, getWeek, getDaysInMonth, differenceInCalendarDays, setDate, addSeconds, addMinutes, addHours, addDays, addWeeks, addMonths, addQuarters, addYears, startOfMinute, startOfHour, startOfDay, startOfWeek, startOfMonth, startOfQuarter, startOfYear, endOfMinute, endOfHour, endOfDay, endOfWeek, endOfMonth, endOfQuarter, endOfYear, getUnixTime, format, isWeekend, isToday, differenceInHours, differenceInMinutes, differenceInDays, differenceInCalendarQuarters, eachMonthOfInterval, eachYearOfInterval, eachWeekOfInterval, eachDayOfInterval, differenceInCalendarYears, eachHourOfInterval, setDefaultOptions } from 'date-fns';
11
- export { addDays, addHours, addMinutes, addMonths, addQuarters, addSeconds, addWeeks, addYears, differenceInCalendarDays, differenceInCalendarQuarters, differenceInDays, differenceInMinutes, eachDayOfInterval, eachHourOfInterval, eachMonthOfInterval, eachWeekOfInterval, endOfDay, endOfHour, endOfMinute, endOfMonth, endOfQuarter, endOfWeek, endOfYear, format, fromUnixTime, getDaysInMonth, getUnixTime, getWeek, isToday, isWeekend, setDate, startOfDay, startOfHour, startOfMinute, startOfMonth, startOfQuarter, startOfWeek, startOfYear } from 'date-fns';
12
- import { TZDate } from '@date-fns/tz';
13
- import { de, ru } from 'date-fns/locale';
14
- import { SelectionModel } from '@angular/cdk/collections';
15
9
  import { coerceBooleanProperty, coerceCssPixelValue } from '@angular/cdk/coercion';
10
+ import { SelectionModel } from '@angular/cdk/collections';
11
+ import { de, ru } from 'date-fns/locale';
12
+ import * as i1 from '@angular/cdk/drag-drop';
13
+ import { CdkDrag, CdkDropList, CdkDragHandle, DragDropModule } from '@angular/cdk/drag-drop';
14
+ import * as i1$1 from '@angular/cdk/scrolling';
15
+ import { CdkScrollable, CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, ScrollingModule } from '@angular/cdk/scrolling';
16
16
  import { __decorate, __param } from 'tslib';
17
17
 
18
18
  class GanttDatePoint {
@@ -378,179 +378,15 @@ class GanttBaselineItemInternal {
378
378
  }
379
379
  }
380
380
 
381
- const primaryDatePointTop = '40%';
382
- const secondaryDatePointTop = '80%';
383
- const viewOptions$6 = {
384
- min: new GanttDate().addYears(-1).startOfYear(),
385
- max: new GanttDate().addYears(1).endOfYear(),
386
- datePrecisionUnit: 'day',
387
- dragPreviewDateFormat: 'MM-dd'
388
- };
389
- class GanttView {
390
- get start() {
391
- return this.start$.getValue();
392
- }
393
- get end() {
394
- return this.end$.getValue();
395
- }
396
- constructor(start, end, options) {
397
- this.showTimeline = true;
398
- this.dateFormats = {};
399
- this.options = Object.assign({}, viewOptions$6, options);
400
- const startDate = start.isCustom
401
- ? this.viewStartOf(start.date)
402
- : this.viewStartOf(start.date.value < this.options.start.value ? start.date : this.options.start);
403
- const endDate = end.isCustom
404
- ? this.viewEndOf(end.date)
405
- : this.viewEndOf(end.date.value > this.options.end.value ? end.date : this.options.end);
406
- this.start$ = new BehaviorSubject(startDate);
407
- this.end$ = new BehaviorSubject(endDate);
408
- this.initialize();
409
- }
410
- /**
411
- * deprecated, please use viewStartOf()
412
- * @deprecated
413
- */
414
- startOf(date) {
415
- return this.viewStartOf(date);
416
- }
417
- /**
418
- * deprecated, please use viewEndOf()
419
- * @deprecated
420
- */
421
- endOf(date) {
422
- return this.viewEndOf(date);
423
- }
424
- startOfPrecision(date) {
425
- switch (this.options.datePrecisionUnit) {
426
- case 'minute':
427
- return date.startOfMinute();
428
- case 'hour':
429
- return date.startOfHour();
430
- default:
431
- return date.startOfDay();
432
- }
433
- }
434
- endOfPrecision(date) {
435
- switch (this.options.datePrecisionUnit) {
436
- case 'minute':
437
- return date.endOfMinute();
438
- case 'hour':
439
- return date.endOfHour();
440
- default:
441
- return date.endOfDay();
442
- }
443
- }
444
- differenceByPrecisionUnit(dateLeft, dateRight) {
445
- switch (this.options.datePrecisionUnit) {
446
- case 'minute':
447
- return differenceInMinutes(dateLeft.value, dateRight.value);
448
- case 'hour':
449
- return differenceInHours(dateLeft.value, dateRight.value);
450
- default:
451
- return differenceInCalendarDays(dateLeft.value, dateRight.value);
452
- }
453
- }
454
- getDateIntervalWidth(start, end) {
455
- let result = 0;
456
- const days = differenceInDays(end.value, start.value);
457
- for (let i = 0; i < Math.abs(days); i++) {
458
- result += this.getDayOccupancyWidth(start.addDays(i));
459
- }
460
- result = days >= 0 ? result : -result;
461
- return Number(result.toFixed(3));
462
- }
463
- initialize() {
464
- this.primaryDatePoints = this.getPrimaryDatePoints();
465
- this.secondaryDatePoints = this.getSecondaryDatePoints();
466
- this.width = this.getWidth();
467
- this.cellWidth = this.getCellWidth();
468
- this.primaryWidth = this.getPrimaryWidth();
469
- }
470
- addStartDate() {
471
- const start = this.viewStartOf(this.start.add(this.options.addAmount * -1, this.options.addUnit));
472
- if (start.value >= this.options.min.value) {
473
- const origin = this.start;
474
- this.start$.next(start);
475
- this.initialize();
476
- return { start: this.start, end: origin };
477
- }
478
- return null;
479
- }
480
- addEndDate() {
481
- const end = this.viewEndOf(this.end.add(this.options.addAmount, this.options.addUnit));
482
- if (end.value <= this.options.max.value) {
483
- const origin = this.end;
484
- this.end$.next(end);
485
- this.initialize();
486
- return { start: origin, end: this.end };
487
- }
488
- return null;
489
- }
490
- updateDate(start, end) {
491
- start = this.viewStartOf(start);
492
- end = this.viewEndOf(end);
493
- if (start.value < this.start.value) {
494
- this.start$.next(start);
495
- }
496
- if (end.value > this.end.value) {
497
- this.end$.next(end);
498
- }
499
- this.initialize();
500
- }
501
- // 获取View的宽度
502
- getWidth() {
503
- return this.getCellWidth() * this.secondaryDatePoints.length;
504
- }
505
- // 获取单个网格的宽度
506
- getCellWidth() {
507
- return this.options.cellWidth;
508
- }
509
- // 获取当前时间的X坐标
510
- getTodayXPoint() {
511
- const toady = new GanttDate().startOfDay();
512
- if (toady.value > this.start.value && toady.value < this.end.value) {
513
- const x = this.getXPointByDate(toady) + this.getDayOccupancyWidth(toady) / 2;
514
- return x;
515
- }
516
- else {
517
- return null;
518
- }
519
- }
520
- // 获取指定时间的X坐标
521
- getXPointByDate(date) {
522
- return this.getDateIntervalWidth(this.start, date);
523
- }
524
- // 根据X坐标获取对应时间
525
- getDateByXPoint(x) {
526
- const indexOfSecondaryDate = Math.max(Math.floor(x / this.getCellWidth()), 0);
527
- const matchDate = this.secondaryDatePoints[Math.min(this.secondaryDatePoints.length - 1, indexOfSecondaryDate)];
528
- const dayWidth = this.getDayOccupancyWidth(matchDate?.start);
529
- if (dayWidth === this.getCellWidth()) {
530
- return matchDate?.start;
531
- }
532
- else {
533
- const day = Math.floor((x % this.getCellWidth()) / dayWidth);
534
- return matchDate?.start.addDays(day);
535
- }
536
- }
537
- // 获取指定时间范围的宽度
538
- getDateRangeWidth(start, end) {
539
- // addSeconds(1) 是因为计算相差天会以一个整天来计算 end时间一般是59分59秒不是一个整天,所以需要加1
540
- return this.getDateIntervalWidth(this.startOfPrecision(start), this.endOfPrecision(end).addSeconds(1));
541
- }
542
- // 根据日期精度获取最小时间范围的宽度
543
- getMinRangeWidthByPrecisionUnit(date) {
544
- switch (this.options.datePrecisionUnit) {
545
- case 'minute':
546
- return this.getDayOccupancyWidth(date) / 24 / 60;
547
- case 'hour':
548
- return this.getDayOccupancyWidth(date) / 24;
549
- default:
550
- return this.getDayOccupancyWidth(date);
551
- }
552
- }
553
- }
381
+ const sideWidth = 400;
382
+ const sideMiddleWidth = 500;
383
+ const sideMaxWidth = 600;
384
+ const sideMinWidth = 400;
385
+ const barBackground = '#6698ff';
386
+ const rangeHeight = 17;
387
+ const todayHeight = 24;
388
+ const todayWidth = 35;
389
+ const todayBorderRadius = 4;
554
390
 
555
391
  var GanttI18nLocale;
556
392
  (function (GanttI18nLocale) {
@@ -563,7 +399,7 @@ var GanttI18nLocale;
563
399
  })(GanttI18nLocale || (GanttI18nLocale = {}));
564
400
  const GANTT_I18N_LOCALE_TOKEN = new InjectionToken('gantt-i18n-locale');
565
401
 
566
- var zhHans = {
402
+ var zhHansLocale = {
567
403
  id: GanttI18nLocale.zhHans,
568
404
  views: {
569
405
  [GanttViewType.hour]: {
@@ -610,7 +446,7 @@ var zhHans = {
610
446
  }
611
447
  };
612
448
 
613
- var zhHant = {
449
+ var zhHantLocale = {
614
450
  id: GanttI18nLocale.zhHant,
615
451
  views: {
616
452
  [GanttViewType.hour]: {
@@ -657,50 +493,188 @@ var zhHant = {
657
493
  }
658
494
  };
659
495
 
660
- var enUsLocale = {
661
- id: GanttI18nLocale.enUs,
662
- views: {
663
- [GanttViewType.hour]: {
664
- label: 'Hourly',
665
- dateFormats: {
666
- primary: 'MMM d',
667
- secondary: 'HH:mm'
668
- }
669
- },
670
- [GanttViewType.day]: {
671
- label: 'Daily',
672
- dateFormats: {
673
- primary: 'MMM yyyy',
674
- secondary: 'd'
675
- }
676
- },
677
- [GanttViewType.week]: {
678
- label: 'Weekly',
679
- dateFormats: {
680
- primary: 'yyyy',
681
- secondary: 'wo'
682
- }
683
- },
684
- [GanttViewType.month]: {
685
- label: 'Monthly',
686
- dateFormats: {
687
- primary: "yyyy 'Q'Q",
688
- secondary: 'MMM'
689
- }
690
- },
691
- [GanttViewType.quarter]: {
692
- label: 'Quarterly',
693
- dateFormats: {
694
- primary: 'yyyy',
695
- secondary: "yyyy 'Q'Q"
696
- }
697
- },
698
- [GanttViewType.year]: {
699
- label: 'Yearly',
700
- dateFormats: {
701
- secondary: 'yyyy'
702
- }
703
- }
496
+ const defaultConfig = {
497
+ locale: GanttI18nLocale.zhHans,
498
+ linkOptions: {
499
+ dependencyTypes: [GanttLinkType.fs],
500
+ showArrow: false,
501
+ lineType: GanttLinkLineType.curve
502
+ },
503
+ styleOptions: {
504
+ headerHeight: 44,
505
+ lineHeight: 44,
506
+ barHeight: 22
507
+ },
508
+ dateOptions: {
509
+ weekStartsOn: 1
510
+ }
511
+ };
512
+ const GANTT_GLOBAL_CONFIG = new InjectionToken('GANTT_GLOBAL_CONFIG');
513
+ class GanttConfigService {
514
+ constructor(globalConfig) {
515
+ const localeId = globalConfig.locale || defaultConfig.locale;
516
+ this.config = {
517
+ locale: localeId,
518
+ dateFormat: Object.assign({}, defaultConfig.dateFormat, globalConfig.dateFormat),
519
+ styleOptions: Object.assign({}, defaultConfig.styleOptions, globalConfig.styleOptions),
520
+ linkOptions: Object.assign({}, defaultConfig.linkOptions, globalConfig.linkOptions),
521
+ dateOptions: Object.assign({}, defaultConfig.dateOptions, globalConfig.dateOptions)
522
+ };
523
+ this.i18nLocales = inject(GANTT_I18N_LOCALE_TOKEN).reduce((result, localeConfig) => {
524
+ result[localeConfig.id] = localeConfig; // 这里使用 `id` 作为 key
525
+ return result;
526
+ }, {
527
+ ['zh-cn']: zhHansLocale,
528
+ ['zh-tw']: zhHantLocale
529
+ });
530
+ if (this.config.dateOptions?.timeZone) {
531
+ setDefaultTimeZone(this.config.dateOptions.timeZone);
532
+ }
533
+ setDefaultOptions({
534
+ locale: this.getDateLocale(),
535
+ weekStartsOn: this.config?.dateOptions?.weekStartsOn
536
+ });
537
+ }
538
+ setLocale(locale) {
539
+ this.config.locale = locale;
540
+ }
541
+ getLocaleConfig() {
542
+ return this.i18nLocales[this.config.locale] ?? this.i18nLocales[this.config.locale.toLowerCase()] ?? zhHansLocale;
543
+ }
544
+ getViewsLocale() {
545
+ return this.getLocaleConfig().views;
546
+ }
547
+ getDateLocale() {
548
+ return this.config.dateOptions?.locale ?? this.getLocaleConfig().dateLocale;
549
+ }
550
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttConfigService, deps: [{ token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
551
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttConfigService, providedIn: 'root' }); }
552
+ }
553
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttConfigService, decorators: [{
554
+ type: Injectable,
555
+ args: [{ providedIn: 'root' }]
556
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
557
+ type: Inject,
558
+ args: [GANTT_GLOBAL_CONFIG]
559
+ }] }] });
560
+
561
+ function isNumber(value) {
562
+ return typeof value === 'number';
563
+ }
564
+ function isString(value) {
565
+ return typeof value === 'string';
566
+ }
567
+ function isUndefined(value) {
568
+ return value === undefined;
569
+ }
570
+ function hexToRgb(color, opacity = 1) {
571
+ if (/^#/g.test(color)) {
572
+ return `rgba(${parseInt(color.slice(1, 3), 16)},${parseInt(color.slice(3, 5), 16)},${parseInt(color.slice(5, 7), 16)},${opacity})`;
573
+ }
574
+ else {
575
+ return color;
576
+ }
577
+ }
578
+ function uniqBy(array, key) {
579
+ const valuesMap = {};
580
+ const result = [];
581
+ (array || []).forEach((value) => {
582
+ const _key = value[key];
583
+ if (!valuesMap[_key]) {
584
+ valuesMap[_key] = value;
585
+ result.push(value);
586
+ }
587
+ });
588
+ return result;
589
+ }
590
+ function flatten(array) {
591
+ return array.reduce((pre, cur) => {
592
+ return pre.concat(Array.isArray(cur) ? flatten(cur) : cur);
593
+ }, []);
594
+ }
595
+ // export function recursiveItems(items: GanttItemInternal[]) {
596
+ // const result = [];
597
+ // (items || []).forEach((item) => {
598
+ // result.push(item);
599
+ // if (item.expanded && item.children) {
600
+ // result.push(...recursiveItems(item.children));
601
+ // }
602
+ // });
603
+ // return result;
604
+ // }
605
+ function recursiveItems(items) {
606
+ const result = [];
607
+ (items || []).forEach((item) => {
608
+ result.push(item);
609
+ if (item.expanded && item.children) {
610
+ result.push(...recursiveItems(item.children));
611
+ }
612
+ });
613
+ return result;
614
+ }
615
+ function getFlatItems(items) {
616
+ const result = [];
617
+ (items || []).forEach((item) => {
618
+ result.push(item);
619
+ if (item.children) {
620
+ result.push(...getFlatItems(item.children));
621
+ }
622
+ });
623
+ return result;
624
+ }
625
+ function keyBy(array, key) {
626
+ const result = {};
627
+ array.forEach((item) => {
628
+ const keyValue = item[key];
629
+ result[keyValue] = item;
630
+ });
631
+ return result;
632
+ }
633
+
634
+ var enUsLocale = {
635
+ id: GanttI18nLocale.enUs,
636
+ views: {
637
+ [GanttViewType.hour]: {
638
+ label: 'Hourly',
639
+ dateFormats: {
640
+ primary: 'MMM d',
641
+ secondary: 'HH:mm'
642
+ }
643
+ },
644
+ [GanttViewType.day]: {
645
+ label: 'Daily',
646
+ dateFormats: {
647
+ primary: 'MMM yyyy',
648
+ secondary: 'd'
649
+ }
650
+ },
651
+ [GanttViewType.week]: {
652
+ label: 'Weekly',
653
+ dateFormats: {
654
+ primary: 'yyyy',
655
+ secondary: 'wo'
656
+ }
657
+ },
658
+ [GanttViewType.month]: {
659
+ label: 'Monthly',
660
+ dateFormats: {
661
+ primary: "yyyy 'Q'Q",
662
+ secondary: 'MMM'
663
+ }
664
+ },
665
+ [GanttViewType.quarter]: {
666
+ label: 'Quarterly',
667
+ dateFormats: {
668
+ primary: 'yyyy',
669
+ secondary: "yyyy 'Q'Q"
670
+ }
671
+ },
672
+ [GanttViewType.year]: {
673
+ label: 'Yearly',
674
+ dateFormats: {
675
+ secondary: 'yyyy'
676
+ }
677
+ }
704
678
  }
705
679
  };
706
680
 
@@ -848,121 +822,202 @@ var ruRuLocale = {
848
822
  };
849
823
 
850
824
  const i18nLocaleProvides = [
851
- { provide: GANTT_I18N_LOCALE_TOKEN, useValue: zhHans, multi: true },
852
- { provide: GANTT_I18N_LOCALE_TOKEN, useValue: zhHant, multi: true },
825
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: zhHansLocale, multi: true },
826
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: zhHantLocale, multi: true },
853
827
  { provide: GANTT_I18N_LOCALE_TOKEN, useValue: enUsLocale, multi: true },
854
828
  { provide: GANTT_I18N_LOCALE_TOKEN, useValue: jaJpLocale, multi: true },
855
829
  { provide: GANTT_I18N_LOCALE_TOKEN, useValue: deDeLocale, multi: true },
856
830
  { provide: GANTT_I18N_LOCALE_TOKEN, useValue: ruRuLocale, multi: true }
857
831
  ];
858
832
 
859
- const viewOptions$5 = {
860
- start: new GanttDate().startOfQuarter().addQuarters(-1),
861
- end: new GanttDate().endOfQuarter().addQuarters(2),
862
- cellWidth: 280,
863
- addAmount: 1,
864
- addUnit: 'quarter',
865
- dateDisplayFormats: zhHant.views.month.dateFormats
833
+ const primaryDatePointTop = '40%';
834
+ const secondaryDatePointTop = '80%';
835
+ const viewOptions$6 = {
836
+ min: new GanttDate().addYears(-1).startOfYear(),
837
+ max: new GanttDate().addYears(1).endOfYear(),
838
+ datePrecisionUnit: 'day',
839
+ dragPreviewDateFormat: 'MM-dd'
866
840
  };
867
- class GanttViewMonth extends GanttView {
868
- constructor(start, end, options) {
869
- super(start, end, Object.assign({}, viewOptions$5, options));
870
- this.viewType = GanttViewType.month;
841
+ class GanttView {
842
+ get start() {
843
+ return this.start$.getValue();
871
844
  }
872
- viewStartOf(date) {
873
- return date.startOfQuarter();
845
+ get end() {
846
+ return this.end$.getValue();
874
847
  }
875
- viewEndOf(date) {
876
- return date.endOfQuarter();
848
+ constructor(start, end, options) {
849
+ this.showTimeline = true;
850
+ this.dateFormats = {};
851
+ this.options = Object.assign({}, viewOptions$6, options);
852
+ const startDate = start.isCustom
853
+ ? this.viewStartOf(start.date)
854
+ : this.viewStartOf(start.date.value < this.options.start.value ? start.date : this.options.start);
855
+ const endDate = end.isCustom
856
+ ? this.viewEndOf(end.date)
857
+ : this.viewEndOf(end.date.value > this.options.end.value ? end.date : this.options.end);
858
+ this.start$ = new BehaviorSubject(startDate);
859
+ this.end$ = new BehaviorSubject(endDate);
860
+ this.initialize();
877
861
  }
878
- getPrimaryWidth() {
879
- return this.getCellWidth() * 3;
862
+ /**
863
+ * deprecated, please use viewStartOf()
864
+ * @deprecated
865
+ */
866
+ startOf(date) {
867
+ return this.viewStartOf(date);
880
868
  }
881
- getDayOccupancyWidth(date) {
882
- return this.cellWidth / date.getDaysInMonth();
869
+ /**
870
+ * deprecated, please use viewEndOf()
871
+ * @deprecated
872
+ */
873
+ endOf(date) {
874
+ return this.viewEndOf(date);
883
875
  }
884
- getPrimaryDatePoints() {
885
- const quarters = differenceInCalendarQuarters(this.end.addSeconds(1).value, this.start.value);
886
- const points = [];
887
- for (let i = 0; i < quarters; i++) {
888
- const start = this.start.addQuarters(i);
889
- const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.yearQuarter || this.options.dateDisplayFormats.primary), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
890
- points.push(point);
876
+ hideHoliday(date) {
877
+ return this.options.hoilday?.hideHoliday && this.options.hoilday?.isHoliday?.(date);
878
+ }
879
+ startOfPrecision(date) {
880
+ switch (this.options.datePrecisionUnit) {
881
+ case 'minute':
882
+ return date.startOfMinute();
883
+ case 'hour':
884
+ return date.startOfHour();
885
+ default:
886
+ return date.startOfDay();
891
887
  }
892
- return points;
893
888
  }
894
- getSecondaryDatePoints() {
895
- const months = eachMonthOfInterval({ start: this.start.value, end: this.end.value });
896
- const points = [];
897
- for (let i = 0; i < months.length; i++) {
898
- const start = new GanttDate(months[i]);
899
- const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.month || this.options.dateDisplayFormats.secondary), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
900
- points.push(point);
889
+ endOfPrecision(date) {
890
+ switch (this.options.datePrecisionUnit) {
891
+ case 'minute':
892
+ return date.endOfMinute();
893
+ case 'hour':
894
+ return date.endOfHour();
895
+ default:
896
+ return date.endOfDay();
901
897
  }
902
- return points;
903
898
  }
904
- }
905
-
906
- const viewOptions$4 = {
907
- start: new GanttDate().addYears(-1).startOfYear(),
908
- end: new GanttDate().addYears(1).endOfYear(),
909
- min: new GanttDate().addYears(-2).startOfYear(),
910
- max: new GanttDate().addYears(2).endOfYear(),
911
- cellWidth: 500,
912
- addAmount: 1,
913
- addUnit: 'year',
914
- dateDisplayFormats: zhHant.views.quarter.dateFormats
915
- };
916
- class GanttViewQuarter extends GanttView {
917
- constructor(start, end, options) {
918
- super(start, end, Object.assign({}, viewOptions$4, options));
919
- this.viewType = GanttViewType.quarter;
899
+ differenceByPrecisionUnit(dateLeft, dateRight) {
900
+ switch (this.options.datePrecisionUnit) {
901
+ case 'minute':
902
+ return differenceInMinutes(dateLeft.value, dateRight.value);
903
+ case 'hour':
904
+ return differenceInHours(dateLeft.value, dateRight.value);
905
+ default:
906
+ return differenceInCalendarDays(dateLeft.value, dateRight.value);
907
+ }
920
908
  }
921
- viewStartOf(date) {
922
- return date.startOfYear();
909
+ getDateIntervalWidth(start, end) {
910
+ let result = 0;
911
+ const days = differenceInDays(end.value, start.value);
912
+ for (let i = 0; i < Math.abs(days); i++) {
913
+ result += this.getDayOccupancyWidth(start.addDays(i));
914
+ }
915
+ result = days >= 0 ? result : -result;
916
+ return Number(result.toFixed(3));
923
917
  }
924
- viewEndOf(date) {
925
- return date.endOfYear();
918
+ initialize() {
919
+ this.cellWidth = this.getCellWidth();
920
+ this.primaryDatePoints = this.getPrimaryDatePoints();
921
+ this.secondaryDatePoints = this.getSecondaryDatePoints();
922
+ this.width = this.getWidth();
923
+ this.primaryWidth = this.getPrimaryWidth();
926
924
  }
927
- getPrimaryWidth() {
928
- return this.getCellWidth() * 4;
925
+ addStartDate() {
926
+ const start = this.viewStartOf(this.start.add(this.options.addAmount * -1, this.options.addUnit));
927
+ if (start.value >= this.options.min.value) {
928
+ const origin = this.start;
929
+ this.start$.next(start);
930
+ this.initialize();
931
+ return { start: this.start, end: origin };
932
+ }
933
+ return null;
929
934
  }
930
- getDayOccupancyWidth(date) {
931
- return this.cellWidth / date.getDaysInQuarter();
935
+ addEndDate() {
936
+ const end = this.viewEndOf(this.end.add(this.options.addAmount, this.options.addUnit));
937
+ if (end.value <= this.options.max.value) {
938
+ const origin = this.end;
939
+ this.end$.next(end);
940
+ this.initialize();
941
+ return { start: origin, end: this.end };
942
+ }
943
+ return null;
932
944
  }
933
- getPrimaryDatePoints() {
934
- const years = eachYearOfInterval({ start: this.start.value, end: this.end.value });
935
- const points = [];
936
- for (let i = 0; i < years.length; i++) {
937
- const start = new GanttDate(years[i]);
938
- const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat?.year || this.options.dateDisplayFormats.primary)}`, (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
939
- points.push(point);
945
+ updateDate(start, end) {
946
+ start = this.viewStartOf(start);
947
+ end = this.viewEndOf(end);
948
+ if (start.value < this.start.value) {
949
+ this.start$.next(start);
940
950
  }
941
- return points;
951
+ if (end.value > this.end.value) {
952
+ this.end$.next(end);
953
+ }
954
+ this.initialize();
942
955
  }
943
- getSecondaryDatePoints() {
944
- const quarters = differenceInCalendarQuarters(this.end.value, this.start.value);
945
- const points = [];
946
- for (let i = 0; i <= quarters; i++) {
947
- const start = this.start.addQuarters(i);
948
- const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.quarter || this.options.dateDisplayFormats.secondary), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
949
- points.push(point);
956
+ // 获取View的宽度
957
+ getWidth() {
958
+ return this.getCellWidth() * this.secondaryDatePoints.length;
959
+ }
960
+ // 获取单个网格的宽度
961
+ getCellWidth() {
962
+ return this.options.cellWidth;
963
+ }
964
+ // 获取当前时间的X坐标
965
+ getTodayXPoint() {
966
+ const toady = new GanttDate().startOfDay();
967
+ if (toady.value > this.start.value && toady.value < this.end.value) {
968
+ const x = this.getXPointByDate(toady) + this.getDayOccupancyWidth(toady) / 2;
969
+ return x;
970
+ }
971
+ else {
972
+ return null;
973
+ }
974
+ }
975
+ // 获取指定时间的X坐标
976
+ getXPointByDate(date) {
977
+ return this.getDateIntervalWidth(this.start, date);
978
+ }
979
+ // 根据X坐标获取对应时间
980
+ getDateByXPoint(x) {
981
+ const indexOfSecondaryDate = Math.max(Math.floor(x / this.getCellWidth()), 0);
982
+ const matchDate = this.secondaryDatePoints[Math.min(this.secondaryDatePoints.length - 1, indexOfSecondaryDate)];
983
+ const dayWidth = this.getDayOccupancyWidth(matchDate?.start);
984
+ if (dayWidth === this.getCellWidth()) {
985
+ return matchDate?.start;
986
+ }
987
+ else {
988
+ const day = Math.floor((x % this.getCellWidth()) / dayWidth);
989
+ return matchDate?.start.addDays(day);
990
+ }
991
+ }
992
+ // 获取指定时间范围的宽度
993
+ getDateRangeWidth(start, end) {
994
+ // addSeconds(1) 是因为计算相差天会以一个整天来计算 end时间一般是59分59秒不是一个整天,所以需要加1
995
+ return this.getDateIntervalWidth(this.startOfPrecision(start), this.endOfPrecision(end).addSeconds(1));
996
+ }
997
+ // 根据日期精度获取最小时间范围的宽度
998
+ getMinRangeWidthByPrecisionUnit(date) {
999
+ switch (this.options.datePrecisionUnit) {
1000
+ case 'minute':
1001
+ return this.getDayOccupancyWidth(date) / 24 / 60;
1002
+ case 'hour':
1003
+ return this.getDayOccupancyWidth(date) / 24;
1004
+ default:
1005
+ return this.getDayOccupancyWidth(date);
950
1006
  }
951
- return points;
952
1007
  }
953
1008
  }
954
1009
 
955
- const viewOptions$3 = {
1010
+ const viewOptions$5 = {
956
1011
  cellWidth: 35,
957
1012
  start: new GanttDate().startOfYear().startOfWeek(),
958
1013
  end: new GanttDate().endOfYear().endOfWeek(),
959
1014
  addAmount: 1,
960
1015
  addUnit: 'month',
961
- dateDisplayFormats: zhHant.views.day.dateFormats
1016
+ dateDisplayFormats: zhHantLocale.views.day.dateFormats
962
1017
  };
963
1018
  class GanttViewDay extends GanttView {
964
1019
  constructor(start, end, options) {
965
- super(start, end, Object.assign({}, viewOptions$3, options));
1020
+ super(start, end, Object.assign({}, viewOptions$5, options));
966
1021
  this.showTimeline = false;
967
1022
  this.viewType = GanttViewType.day;
968
1023
  }
@@ -975,7 +1030,10 @@ class GanttViewDay extends GanttView {
975
1030
  getPrimaryWidth() {
976
1031
  return this.getCellWidth() * 7;
977
1032
  }
978
- getDayOccupancyWidth() {
1033
+ getDayOccupancyWidth(date) {
1034
+ if (this.hideHoliday(date)) {
1035
+ return 0;
1036
+ }
979
1037
  return this.cellWidth;
980
1038
  }
981
1039
  getPrimaryDatePoints() {
@@ -983,14 +1041,19 @@ class GanttViewDay extends GanttView {
983
1041
  const points = [];
984
1042
  for (let i = 0; i < weeks.length; i++) {
985
1043
  const weekStart = new GanttDate(weeks[i]);
1044
+ const weekEnd = weekStart.addWeeks(1);
986
1045
  const increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
987
- const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat?.yearMonth || this.options.dateDisplayFormats.primary), (this.getCellWidth() * 7) / 2 + i * (this.getCellWidth() * 7), primaryDatePointTop);
1046
+ const pointWidth = this.getDateIntervalWidth(weekStart, weekEnd);
1047
+ const lastPoint = points[points.length - 1];
1048
+ const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat?.yearMonth || this.options.dateDisplayFormats.primary), pointWidth / 2 + (lastPoint?.rightX || 0), primaryDatePointTop);
1049
+ point.leftX = lastPoint?.rightX || 0;
1050
+ point.rightX = point.leftX + pointWidth;
988
1051
  points.push(point);
989
1052
  }
990
1053
  return points;
991
1054
  }
992
1055
  getSecondaryDatePoints() {
993
- const days = eachDayOfInterval({ start: this.start.value, end: this.end.value });
1056
+ const days = eachDayOfInterval({ start: this.start.value, end: this.end.value }).filter((day) => !this.hideHoliday(new GanttDate(day)));
994
1057
  const points = [];
995
1058
  for (let i = 0; i < days.length; i++) {
996
1059
  const start = new GanttDate(days[i]);
@@ -1004,115 +1067,19 @@ class GanttViewDay extends GanttView {
1004
1067
  }
1005
1068
  }
1006
1069
 
1007
- const viewOptions$2 = {
1008
- cellWidth: 280,
1009
- start: new GanttDate().startOfYear().startOfWeek(),
1010
- end: new GanttDate().endOfYear().endOfWeek(),
1011
- addAmount: 1,
1012
- addUnit: 'month',
1013
- dateDisplayFormats: zhHant.views.week.dateFormats
1014
- };
1015
- class GanttViewWeek extends GanttView {
1016
- constructor(start, end, options) {
1017
- super(start, end, Object.assign({}, viewOptions$2, options));
1018
- this.viewType = GanttViewType.week;
1019
- }
1020
- viewStartOf(date) {
1021
- return date.startOfWeek();
1022
- }
1023
- viewEndOf(date) {
1024
- return date.endOfWeek();
1025
- }
1026
- getPrimaryWidth() {
1027
- return this.getCellWidth();
1028
- }
1029
- getDayOccupancyWidth() {
1030
- return this.cellWidth / 7;
1031
- }
1032
- getPrimaryDatePoints() {
1033
- const weeks = eachWeekOfInterval({ start: this.start.value, end: this.end.addSeconds(1).value });
1034
- const points = [];
1035
- for (let i = 0; i < weeks.length; i++) {
1036
- const weekStart = new GanttDate(weeks[i]);
1037
- const increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
1038
- const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat?.year || this.options.dateDisplayFormats.primary), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
1039
- points.push(point);
1040
- }
1041
- return points;
1042
- }
1043
- getSecondaryDatePoints() {
1044
- const weeks = eachWeekOfInterval({ start: this.start.value, end: this.end.addSeconds(1).value });
1045
- const points = [];
1046
- for (let i = 0; i < weeks.length; i++) {
1047
- const start = new GanttDate(weeks[i]);
1048
- const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat?.week || this.options.dateDisplayFormats.secondary)}`, i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
1049
- points.push(point);
1050
- }
1051
- return points;
1052
- }
1053
- }
1054
-
1055
- const viewOptions$1 = {
1056
- cellWidth: 480,
1057
- start: new GanttDate().addYears(-2).startOfYear(),
1058
- end: new GanttDate().addYears(2).endOfYear(),
1059
- addAmount: 1,
1060
- addUnit: 'year',
1061
- dateDisplayFormats: zhHant.views.year.dateFormats
1062
- };
1063
- class GanttViewYear extends GanttView {
1064
- constructor(start, end, options) {
1065
- super(start, end, Object.assign({}, viewOptions$1, options));
1066
- this.viewType = GanttViewType.year;
1067
- }
1068
- viewStartOf(date) {
1069
- return date.startOfYear();
1070
- }
1071
- viewEndOf(date) {
1072
- return date.endOfYear();
1073
- }
1074
- getPrimaryWidth() {
1075
- return this.getCellWidth();
1076
- }
1077
- getDayOccupancyWidth(date) {
1078
- return this.cellWidth / date.getDaysInYear();
1079
- }
1080
- getPrimaryDatePoints() {
1081
- const years = eachYearOfInterval({ start: this.start.value, end: this.end.value });
1082
- const points = [];
1083
- for (let i = 0; i < years.length; i++) {
1084
- const start = new GanttDate(years[i]);
1085
- const point = new GanttDatePoint(start, ``, this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
1086
- points.push(point);
1087
- }
1088
- return points;
1089
- }
1090
- getSecondaryDatePoints() {
1091
- const years = differenceInCalendarYears(this.end.value, this.start.value);
1092
- const points = [];
1093
- const pointTop = '60%';
1094
- for (let i = 0; i <= years; i++) {
1095
- const start = this.start.addYears(i);
1096
- const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat?.year || this.options.dateDisplayFormats.secondary || this.options.dateDisplayFormats.primary)}`, i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
1097
- points.push(point);
1098
- }
1099
- return points;
1100
- }
1101
- }
1102
-
1103
- const viewOptions = {
1070
+ const viewOptions$4 = {
1104
1071
  cellWidth: 80,
1105
1072
  start: new GanttDate().startOfMonth(),
1106
1073
  end: new GanttDate().endOfMonth(),
1107
1074
  datePrecisionUnit: 'minute',
1108
1075
  addAmount: 1,
1109
1076
  addUnit: 'week',
1110
- dateDisplayFormats: zhHant.views.hour.dateFormats,
1077
+ dateDisplayFormats: zhHantLocale.views.hour.dateFormats,
1111
1078
  dragPreviewDateFormat: 'HH:mm'
1112
1079
  };
1113
1080
  class GanttViewHour extends GanttView {
1114
1081
  constructor(start, end, options) {
1115
- super(start, end, Object.assign({}, viewOptions, options));
1082
+ super(start, end, Object.assign({}, viewOptions$4, options));
1116
1083
  this.showTimeline = true;
1117
1084
  this.viewType = GanttViewType.hour;
1118
1085
  }
@@ -1183,158 +1150,212 @@ class GanttViewHour extends GanttView {
1183
1150
  }
1184
1151
  }
1185
1152
 
1186
- const ganttViewsMap = {
1187
- [GanttViewType.hour]: GanttViewHour,
1188
- [GanttViewType.day]: GanttViewDay,
1189
- [GanttViewType.week]: GanttViewWeek,
1190
- [GanttViewType.month]: GanttViewMonth,
1191
- [GanttViewType.quarter]: GanttViewQuarter,
1192
- [GanttViewType.year]: GanttViewYear
1153
+ const viewOptions$3 = {
1154
+ start: new GanttDate().startOfQuarter().addQuarters(-1),
1155
+ end: new GanttDate().endOfQuarter().addQuarters(2),
1156
+ cellWidth: 280,
1157
+ addAmount: 1,
1158
+ addUnit: 'quarter',
1159
+ dateDisplayFormats: zhHantLocale.views.month.dateFormats
1193
1160
  };
1194
- function registerView(type, view) {
1195
- ganttViewsMap[type] = view;
1196
- }
1197
- function createViewFactory(type, start, end, options) {
1198
- return new ganttViewsMap[type](start, end, options);
1161
+ class GanttViewMonth extends GanttView {
1162
+ constructor(start, end, options) {
1163
+ super(start, end, Object.assign({}, viewOptions$3, options));
1164
+ this.viewType = GanttViewType.month;
1165
+ }
1166
+ viewStartOf(date) {
1167
+ return date.startOfQuarter();
1168
+ }
1169
+ viewEndOf(date) {
1170
+ return date.endOfQuarter();
1171
+ }
1172
+ getPrimaryWidth() {
1173
+ return this.getCellWidth() * 3;
1174
+ }
1175
+ getDayOccupancyWidth(date) {
1176
+ return this.cellWidth / date.getDaysInMonth();
1177
+ }
1178
+ getPrimaryDatePoints() {
1179
+ const quarters = differenceInCalendarQuarters(this.end.addSeconds(1).value, this.start.value);
1180
+ const points = [];
1181
+ for (let i = 0; i < quarters; i++) {
1182
+ const start = this.start.addQuarters(i);
1183
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.yearQuarter || this.options.dateDisplayFormats.primary), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
1184
+ points.push(point);
1185
+ }
1186
+ return points;
1187
+ }
1188
+ getSecondaryDatePoints() {
1189
+ const months = eachMonthOfInterval({ start: this.start.value, end: this.end.value });
1190
+ const points = [];
1191
+ for (let i = 0; i < months.length; i++) {
1192
+ const start = new GanttDate(months[i]);
1193
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.month || this.options.dateDisplayFormats.secondary), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
1194
+ points.push(point);
1195
+ }
1196
+ return points;
1197
+ }
1199
1198
  }
1200
1199
 
1201
- function isNumber(value) {
1202
- return typeof value === 'number';
1203
- }
1204
- function isString(value) {
1205
- return typeof value === 'string';
1206
- }
1207
- function isUndefined(value) {
1208
- return value === undefined;
1209
- }
1210
- function hexToRgb(color, opacity = 1) {
1211
- if (/^#/g.test(color)) {
1212
- return `rgba(${parseInt(color.slice(1, 3), 16)},${parseInt(color.slice(3, 5), 16)},${parseInt(color.slice(5, 7), 16)},${opacity})`;
1200
+ const viewOptions$2 = {
1201
+ start: new GanttDate().addYears(-1).startOfYear(),
1202
+ end: new GanttDate().addYears(1).endOfYear(),
1203
+ min: new GanttDate().addYears(-2).startOfYear(),
1204
+ max: new GanttDate().addYears(2).endOfYear(),
1205
+ cellWidth: 500,
1206
+ addAmount: 1,
1207
+ addUnit: 'year',
1208
+ dateDisplayFormats: zhHantLocale.views.quarter.dateFormats
1209
+ };
1210
+ class GanttViewQuarter extends GanttView {
1211
+ constructor(start, end, options) {
1212
+ super(start, end, Object.assign({}, viewOptions$2, options));
1213
+ this.viewType = GanttViewType.quarter;
1213
1214
  }
1214
- else {
1215
- return color;
1215
+ viewStartOf(date) {
1216
+ return date.startOfYear();
1216
1217
  }
1217
- }
1218
- function uniqBy(array, key) {
1219
- const valuesMap = {};
1220
- const result = [];
1221
- (array || []).forEach((value) => {
1222
- const _key = value[key];
1223
- if (!valuesMap[_key]) {
1224
- valuesMap[_key] = value;
1225
- result.push(value);
1218
+ viewEndOf(date) {
1219
+ return date.endOfYear();
1220
+ }
1221
+ getPrimaryWidth() {
1222
+ return this.getCellWidth() * 4;
1223
+ }
1224
+ getDayOccupancyWidth(date) {
1225
+ return this.cellWidth / date.getDaysInQuarter();
1226
+ }
1227
+ getPrimaryDatePoints() {
1228
+ const years = eachYearOfInterval({ start: this.start.value, end: this.end.value });
1229
+ const points = [];
1230
+ for (let i = 0; i < years.length; i++) {
1231
+ const start = new GanttDate(years[i]);
1232
+ const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat?.year || this.options.dateDisplayFormats.primary)}`, (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
1233
+ points.push(point);
1226
1234
  }
1227
- });
1228
- return result;
1229
- }
1230
- function flatten(array) {
1231
- return array.reduce((pre, cur) => {
1232
- return pre.concat(Array.isArray(cur) ? flatten(cur) : cur);
1233
- }, []);
1234
- }
1235
- // export function recursiveItems(items: GanttItemInternal[]) {
1236
- // const result = [];
1237
- // (items || []).forEach((item) => {
1238
- // result.push(item);
1239
- // if (item.expanded && item.children) {
1240
- // result.push(...recursiveItems(item.children));
1241
- // }
1242
- // });
1243
- // return result;
1244
- // }
1245
- function recursiveItems(items) {
1246
- const result = [];
1247
- (items || []).forEach((item) => {
1248
- result.push(item);
1249
- if (item.expanded && item.children) {
1250
- result.push(...recursiveItems(item.children));
1235
+ return points;
1236
+ }
1237
+ getSecondaryDatePoints() {
1238
+ const quarters = differenceInCalendarQuarters(this.end.value, this.start.value);
1239
+ const points = [];
1240
+ for (let i = 0; i <= quarters; i++) {
1241
+ const start = this.start.addQuarters(i);
1242
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.quarter || this.options.dateDisplayFormats.secondary), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
1243
+ points.push(point);
1251
1244
  }
1252
- });
1253
- return result;
1245
+ return points;
1246
+ }
1254
1247
  }
1255
- function getFlatItems(items) {
1256
- const result = [];
1257
- (items || []).forEach((item) => {
1258
- result.push(item);
1259
- if (item.children) {
1260
- result.push(...getFlatItems(item.children));
1248
+
1249
+ const viewOptions$1 = {
1250
+ cellWidth: 280,
1251
+ start: new GanttDate().startOfYear().startOfWeek(),
1252
+ end: new GanttDate().endOfYear().endOfWeek(),
1253
+ addAmount: 1,
1254
+ addUnit: 'month',
1255
+ dateDisplayFormats: zhHantLocale.views.week.dateFormats
1256
+ };
1257
+ class GanttViewWeek extends GanttView {
1258
+ constructor(start, end, options) {
1259
+ super(start, end, Object.assign({}, viewOptions$1, options));
1260
+ this.viewType = GanttViewType.week;
1261
+ }
1262
+ viewStartOf(date) {
1263
+ return date.startOfWeek();
1264
+ }
1265
+ viewEndOf(date) {
1266
+ return date.endOfWeek();
1267
+ }
1268
+ getPrimaryWidth() {
1269
+ return this.getCellWidth();
1270
+ }
1271
+ getDayOccupancyWidth() {
1272
+ return this.cellWidth / 7;
1273
+ }
1274
+ getPrimaryDatePoints() {
1275
+ const weeks = eachWeekOfInterval({ start: this.start.value, end: this.end.addSeconds(1).value });
1276
+ const points = [];
1277
+ for (let i = 0; i < weeks.length; i++) {
1278
+ const weekStart = new GanttDate(weeks[i]);
1279
+ const increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
1280
+ const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat?.year || this.options.dateDisplayFormats.primary), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
1281
+ points.push(point);
1261
1282
  }
1262
- });
1263
- return result;
1264
- }
1265
- function keyBy(array, key) {
1266
- const result = {};
1267
- array.forEach((item) => {
1268
- const keyValue = item[key];
1269
- result[keyValue] = item;
1270
- });
1271
- return result;
1283
+ return points;
1284
+ }
1285
+ getSecondaryDatePoints() {
1286
+ const weeks = eachWeekOfInterval({ start: this.start.value, end: this.end.addSeconds(1).value });
1287
+ const points = [];
1288
+ for (let i = 0; i < weeks.length; i++) {
1289
+ const start = new GanttDate(weeks[i]);
1290
+ const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat?.week || this.options.dateDisplayFormats.secondary)}`, i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
1291
+ points.push(point);
1292
+ }
1293
+ return points;
1294
+ }
1272
1295
  }
1273
1296
 
1274
- const defaultConfig = {
1275
- locale: GanttI18nLocale.zhHans,
1276
- linkOptions: {
1277
- dependencyTypes: [GanttLinkType.fs],
1278
- showArrow: false,
1279
- lineType: GanttLinkLineType.curve
1280
- },
1281
- styleOptions: {
1282
- headerHeight: 44,
1283
- lineHeight: 44,
1284
- barHeight: 22
1285
- },
1286
- dateOptions: {
1287
- weekStartsOn: 1
1288
- }
1297
+ const viewOptions = {
1298
+ cellWidth: 480,
1299
+ start: new GanttDate().addYears(-2).startOfYear(),
1300
+ end: new GanttDate().addYears(2).endOfYear(),
1301
+ addAmount: 1,
1302
+ addUnit: 'year',
1303
+ dateDisplayFormats: zhHantLocale.views.year.dateFormats
1289
1304
  };
1290
- const GANTT_GLOBAL_CONFIG = new InjectionToken('GANTT_GLOBAL_CONFIG');
1291
- class GanttConfigService {
1292
- constructor(globalConfig) {
1293
- const localeId = globalConfig.locale || defaultConfig.locale;
1294
- this.config = {
1295
- locale: localeId,
1296
- dateFormat: Object.assign({}, defaultConfig.dateFormat, globalConfig.dateFormat),
1297
- styleOptions: Object.assign({}, defaultConfig.styleOptions, globalConfig.styleOptions),
1298
- linkOptions: Object.assign({}, defaultConfig.linkOptions, globalConfig.linkOptions),
1299
- dateOptions: Object.assign({}, defaultConfig.dateOptions, globalConfig.dateOptions)
1300
- };
1301
- this.i18nLocales = inject(GANTT_I18N_LOCALE_TOKEN).reduce((result, localeConfig) => {
1302
- result[localeConfig.id] = localeConfig; // 这里使用 `id` 作为 key
1303
- return result;
1304
- }, {
1305
- ['zh-cn']: zhHans,
1306
- ['zh-tw']: zhHant
1307
- });
1308
- if (this.config.dateOptions?.timeZone) {
1309
- setDefaultTimeZone(this.config.dateOptions.timeZone);
1310
- }
1311
- setDefaultOptions({
1312
- locale: this.getDateLocale(),
1313
- weekStartsOn: this.config?.dateOptions?.weekStartsOn
1314
- });
1305
+ class GanttViewYear extends GanttView {
1306
+ constructor(start, end, options) {
1307
+ super(start, end, Object.assign({}, viewOptions, options));
1308
+ this.viewType = GanttViewType.year;
1315
1309
  }
1316
- setLocale(locale) {
1317
- this.config.locale = locale;
1310
+ viewStartOf(date) {
1311
+ return date.startOfYear();
1318
1312
  }
1319
- getLocaleConfig() {
1320
- return this.i18nLocales[this.config.locale] ?? this.i18nLocales[this.config.locale.toLowerCase()] ?? zhHans;
1313
+ viewEndOf(date) {
1314
+ return date.endOfYear();
1321
1315
  }
1322
- getViewsLocale() {
1323
- return this.getLocaleConfig().views;
1316
+ getPrimaryWidth() {
1317
+ return this.getCellWidth();
1324
1318
  }
1325
- getDateLocale() {
1326
- return this.config.dateOptions?.locale ?? this.getLocaleConfig().dateLocale;
1319
+ getDayOccupancyWidth(date) {
1320
+ return this.cellWidth / date.getDaysInYear();
1321
+ }
1322
+ getPrimaryDatePoints() {
1323
+ const years = eachYearOfInterval({ start: this.start.value, end: this.end.value });
1324
+ const points = [];
1325
+ for (let i = 0; i < years.length; i++) {
1326
+ const start = new GanttDate(years[i]);
1327
+ const point = new GanttDatePoint(start, ``, this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
1328
+ points.push(point);
1329
+ }
1330
+ return points;
1331
+ }
1332
+ getSecondaryDatePoints() {
1333
+ const years = differenceInCalendarYears(this.end.value, this.start.value);
1334
+ const points = [];
1335
+ const pointTop = '60%';
1336
+ for (let i = 0; i <= years; i++) {
1337
+ const start = this.start.addYears(i);
1338
+ const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat?.year || this.options.dateDisplayFormats.secondary || this.options.dateDisplayFormats.primary)}`, i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
1339
+ points.push(point);
1340
+ }
1341
+ return points;
1327
1342
  }
1328
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttConfigService, deps: [{ token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
1329
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttConfigService, providedIn: 'root' }); }
1330
1343
  }
1331
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttConfigService, decorators: [{
1332
- type: Injectable,
1333
- args: [{ providedIn: 'root' }]
1334
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1335
- type: Inject,
1336
- args: [GANTT_GLOBAL_CONFIG]
1337
- }] }] });
1344
+
1345
+ const ganttViewsMap = {
1346
+ [GanttViewType.hour]: GanttViewHour,
1347
+ [GanttViewType.day]: GanttViewDay,
1348
+ [GanttViewType.week]: GanttViewWeek,
1349
+ [GanttViewType.month]: GanttViewMonth,
1350
+ [GanttViewType.quarter]: GanttViewQuarter,
1351
+ [GanttViewType.year]: GanttViewYear
1352
+ };
1353
+ function registerView(type, view) {
1354
+ ganttViewsMap[type] = view;
1355
+ }
1356
+ function createViewFactory(type, start, end, options) {
1357
+ return new ganttViewsMap[type](start, end, options);
1358
+ }
1338
1359
 
1339
1360
  class GanttUpper {
1340
1361
  set linkOptions(options) {
@@ -1396,7 +1417,6 @@ class GanttUpper {
1396
1417
  this.viewChange = new EventEmitter();
1397
1418
  this.expandChange = new EventEmitter();
1398
1419
  this.configService = inject(GanttConfigService);
1399
- this.computeAllRefs = true;
1400
1420
  this.linkDragEnded = new EventEmitter();
1401
1421
  this.items = [];
1402
1422
  this.groups = [];
@@ -1503,14 +1523,12 @@ class GanttUpper {
1503
1523
  };
1504
1524
  }
1505
1525
  computeRefs() {
1506
- if (this.computeAllRefs) {
1507
- this.groups.forEach((group) => {
1508
- const groupItems = recursiveItems(group.items);
1509
- this.computeItemsRefs(...groupItems);
1510
- });
1511
- const items = recursiveItems(this.items);
1512
- this.computeItemsRefs(...items);
1513
- }
1526
+ this.groups.forEach((group) => {
1527
+ const groupItems = recursiveItems(group.items);
1528
+ this.computeItemsRefs(...groupItems);
1529
+ });
1530
+ const items = recursiveItems(this.items);
1531
+ this.computeItemsRefs(...items);
1514
1532
  }
1515
1533
  initSelectionModel() {
1516
1534
  return new SelectionModel(this.multiple, []);
@@ -1524,7 +1542,7 @@ class GanttUpper {
1524
1542
  this.groups.forEach((group) => {
1525
1543
  group.setExpand(expanded);
1526
1544
  });
1527
- this.expandChange.next(null);
1545
+ this.expandChange.emit(this.groups);
1528
1546
  this.cdr.detectChanges();
1529
1547
  }
1530
1548
  ngOnInit() {
@@ -1732,6 +1750,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
1732
1750
  }] } });
1733
1751
  const GANTT_UPPER_TOKEN = new InjectionToken('GANTT_UPPER_TOKEN');
1734
1752
 
1753
+ class GanttItemUpper {
1754
+ constructor(elementRef, ganttUpper) {
1755
+ this.elementRef = elementRef;
1756
+ this.ganttUpper = ganttUpper;
1757
+ this.firstChange = true;
1758
+ this.unsubscribe$ = new Subject();
1759
+ this.refsUnsubscribe$ = new Subject();
1760
+ }
1761
+ ngOnInit() {
1762
+ this.firstChange = false;
1763
+ this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
1764
+ this.setPositions();
1765
+ });
1766
+ }
1767
+ ngOnChanges(changes) {
1768
+ if (!this.firstChange) {
1769
+ this.itemChange(changes.item.currentValue);
1770
+ }
1771
+ }
1772
+ itemChange(item) {
1773
+ this.refsUnsubscribe$.next();
1774
+ this.refsUnsubscribe$.complete();
1775
+ this.item = item;
1776
+ this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
1777
+ this.setPositions();
1778
+ });
1779
+ }
1780
+ setPositions() {
1781
+ const itemElement = this.elementRef.nativeElement;
1782
+ itemElement.style.left = this.item.refs?.x + 'px';
1783
+ itemElement.style.top = this.item.refs?.y + 'px';
1784
+ itemElement.style.width = this.item.refs?.width + 'px';
1785
+ if (this.item.type === GanttItemType.bar) {
1786
+ itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
1787
+ }
1788
+ else if (this.item.type === GanttItemType.range) {
1789
+ itemElement.style.height = rangeHeight + 'px';
1790
+ }
1791
+ }
1792
+ ngOnDestroy() {
1793
+ this.unsubscribe$.next();
1794
+ this.unsubscribe$.complete();
1795
+ this.refsUnsubscribe$.next();
1796
+ this.refsUnsubscribe$.complete();
1797
+ }
1798
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttItemUpper, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Directive }); }
1799
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.3", type: GanttItemUpper, isStandalone: true, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0 }); }
1800
+ }
1801
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttItemUpper, decorators: [{
1802
+ type: Directive
1803
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
1804
+ type: Inject,
1805
+ args: [GANTT_UPPER_TOKEN]
1806
+ }] }], propDecorators: { template: [{
1807
+ type: Input
1808
+ }], item: [{
1809
+ type: Input
1810
+ }] } });
1811
+
1735
1812
  function getDependencyType(path, dependencyTypes) {
1736
1813
  if (dependencyTypes.includes(GanttLinkType.ss) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.start) {
1737
1814
  return GanttLinkType.ss;
@@ -2323,7 +2400,8 @@ class GanttBarDrag {
2323
2400
  const currentX = this.item().refs.x + this.barDragMoveDistance + this.dragScrollDistance;
2324
2401
  const currentDate = this.ganttUpper.view.getDateByXPoint(currentX);
2325
2402
  const currentStartX = this.ganttUpper.view.getXPointByDate(currentDate);
2326
- const diffs = this.ganttUpper.view.differenceByPrecisionUnit(this.item().end, this.item().start);
2403
+ const currentEndDate = this.ganttUpper.view.getDateByXPoint(currentX + this.item().refs.width);
2404
+ const diffs = this.ganttUpper.view.differenceByPrecisionUnit(currentEndDate, currentDate);
2327
2405
  let start = currentDate;
2328
2406
  let end = currentDate.add(diffs, this.ganttUpper.view?.options?.datePrecisionUnit);
2329
2407
  // 日视图特殊逻辑处理
@@ -2513,114 +2591,45 @@ class GanttBarDrag {
2513
2591
  dragRef.disabled = this.dragDisabled;
2514
2592
  });
2515
2593
  }
2516
- else if (!this.dragDisabled) {
2517
- this.barHandleDragRefs = this.createBarHandleDrags();
2518
- }
2519
- }
2520
- createLinkDragRefs() {
2521
- if (this.linkDragRefs.length > 0) {
2522
- this.linkDragRefs.forEach((dragRef) => {
2523
- dragRef.disabled = this.linkDragDisabled;
2524
- });
2525
- }
2526
- else if (!this.linkDragDisabled) {
2527
- this.linkDragRefs = this.createLinkHandleDrags();
2528
- }
2529
- }
2530
- createDrags() {
2531
- this.createMouseEvents();
2532
- this.createBarDragRef();
2533
- this.createBarHandleDragRefs();
2534
- this.createLinkDragRefs();
2535
- }
2536
- updateItem(item) {
2537
- this.item.set(item);
2538
- }
2539
- ngOnDestroy() {
2540
- this.closeDragBackdrop();
2541
- this.barDragRef?.dispose();
2542
- this.linkDragRefs?.forEach((dragRef) => dragRef.dispose());
2543
- this.barHandleDragRefs?.forEach((dragRef) => dragRef.dispose());
2544
- this.destroy$.next();
2545
- this.destroy$.complete();
2546
- this.stopScrolling();
2547
- this.stopScrollTimers$.complete();
2548
- }
2549
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttBarDrag, deps: [{ token: i1.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
2550
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttBarDrag }); }
2551
- }
2552
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttBarDrag, decorators: [{
2553
- type: Injectable
2554
- }], ctorParameters: () => [{ type: i1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: i0.NgZone }] });
2555
-
2556
- const sideWidth = 400;
2557
- const sideMiddleWidth = 500;
2558
- const sideMaxWidth = 600;
2559
- const sideMinWidth = 400;
2560
- const barBackground = '#6698ff';
2561
- const rangeHeight = 17;
2562
- const todayHeight = 24;
2563
- const todayWidth = 35;
2564
- const todayBorderRadius = 4;
2565
-
2566
- class GanttItemUpper {
2567
- constructor(elementRef, ganttUpper) {
2568
- this.elementRef = elementRef;
2569
- this.ganttUpper = ganttUpper;
2570
- this.firstChange = true;
2571
- this.unsubscribe$ = new Subject();
2572
- this.refsUnsubscribe$ = new Subject();
2573
- }
2574
- ngOnInit() {
2575
- this.firstChange = false;
2576
- this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
2577
- this.setPositions();
2578
- });
2579
- }
2580
- ngOnChanges(changes) {
2581
- if (!this.firstChange) {
2582
- this.itemChange(changes.item.currentValue);
2583
- }
2584
- }
2585
- itemChange(item) {
2586
- this.refsUnsubscribe$.next();
2587
- this.refsUnsubscribe$.complete();
2588
- this.item = item;
2589
- this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
2590
- this.setPositions();
2591
- });
2592
- }
2593
- setPositions() {
2594
- const itemElement = this.elementRef.nativeElement;
2595
- itemElement.style.left = this.item.refs?.x + 'px';
2596
- itemElement.style.top = this.item.refs?.y + 'px';
2597
- itemElement.style.width = this.item.refs?.width + 'px';
2598
- if (this.item.type === GanttItemType.bar) {
2599
- itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2594
+ else if (!this.dragDisabled) {
2595
+ this.barHandleDragRefs = this.createBarHandleDrags();
2600
2596
  }
2601
- else if (this.item.type === GanttItemType.range) {
2602
- itemElement.style.height = rangeHeight + 'px';
2597
+ }
2598
+ createLinkDragRefs() {
2599
+ if (this.linkDragRefs.length > 0) {
2600
+ this.linkDragRefs.forEach((dragRef) => {
2601
+ dragRef.disabled = this.linkDragDisabled;
2602
+ });
2603
+ }
2604
+ else if (!this.linkDragDisabled) {
2605
+ this.linkDragRefs = this.createLinkHandleDrags();
2603
2606
  }
2604
2607
  }
2608
+ createDrags() {
2609
+ this.createMouseEvents();
2610
+ this.createBarDragRef();
2611
+ this.createBarHandleDragRefs();
2612
+ this.createLinkDragRefs();
2613
+ }
2614
+ updateItem(item) {
2615
+ this.item.set(item);
2616
+ }
2605
2617
  ngOnDestroy() {
2606
- this.unsubscribe$.next();
2607
- this.unsubscribe$.complete();
2608
- this.refsUnsubscribe$.next();
2609
- this.refsUnsubscribe$.complete();
2618
+ this.closeDragBackdrop();
2619
+ this.barDragRef?.dispose();
2620
+ this.linkDragRefs?.forEach((dragRef) => dragRef.dispose());
2621
+ this.barHandleDragRefs?.forEach((dragRef) => dragRef.dispose());
2622
+ this.destroy$.next();
2623
+ this.destroy$.complete();
2624
+ this.stopScrolling();
2625
+ this.stopScrollTimers$.complete();
2610
2626
  }
2611
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttItemUpper, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Directive }); }
2612
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.3", type: GanttItemUpper, isStandalone: true, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0 }); }
2627
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttBarDrag, deps: [{ token: i1.DragDrop }, { token: GanttDomService }, { token: GanttDragContainer }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
2628
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttBarDrag }); }
2613
2629
  }
2614
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttItemUpper, decorators: [{
2615
- type: Directive
2616
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2617
- type: Inject,
2618
- args: [GANTT_UPPER_TOKEN]
2619
- }] }], propDecorators: { template: [{
2620
- type: Input
2621
- }], item: [{
2622
- type: Input
2623
- }] } });
2630
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttBarDrag, decorators: [{
2631
+ type: Injectable
2632
+ }], ctorParameters: () => [{ type: i1.DragDrop }, { type: GanttDomService }, { type: GanttDragContainer }, { type: i0.NgZone }] });
2624
2633
 
2625
2634
  function linearGradient(sideOrCorner, color, stop) {
2626
2635
  return `linear-gradient(${sideOrCorner},${color} 0%,${stop} 40%)`;
@@ -2682,11 +2691,14 @@ class NgxGanttBarComponent extends GanttItemUpper {
2682
2691
  this.barClick.emit({ event, item: this.item.origin });
2683
2692
  }
2684
2693
  setContentBackground() {
2694
+ let style = { ...(this.item.barStyle || {}) };
2695
+ const contentElement = this.contentElementRef.nativeElement;
2696
+ const barElement = this.elementRef.nativeElement;
2697
+ if (this.item.barStyle && Object.prototype.hasOwnProperty.call(this.item.barStyle, 'visibility')) {
2698
+ barElement.style.visibility = this.item.barStyle?.visibility;
2699
+ }
2685
2700
  if (this.item.refs?.width) {
2686
- const contentElement = this.contentElementRef.nativeElement;
2687
2701
  const color = this.item.color || barBackground;
2688
- const style = this.item.barStyle || {};
2689
- const barElement = this.elementRef.nativeElement;
2690
2702
  if (this.item.origin.start && this.item.origin.end) {
2691
2703
  style.background = color;
2692
2704
  style.borderRadius = '';
@@ -2706,13 +2718,13 @@ class NgxGanttBarComponent extends GanttItemUpper {
2706
2718
  if (this.item.progress >= 0) {
2707
2719
  const contentProgressElement = contentElement.querySelector('.gantt-bar-content-progress');
2708
2720
  style.background = hexToRgb(color, 0.3);
2709
- style.borderRadius = '';
2710
2721
  contentProgressElement.style.background = color;
2711
2722
  }
2712
- for (const key in style) {
2713
- if (style.hasOwnProperty(key)) {
2714
- contentElement.style[key] = style[key];
2715
- }
2723
+ }
2724
+ style = Object.assign({}, style, this.item.barStyle || {});
2725
+ for (const key in style) {
2726
+ if (style.hasOwnProperty(key)) {
2727
+ contentElement.style[key] = style[key];
2716
2728
  }
2717
2729
  }
2718
2730
  }
@@ -2808,234 +2820,449 @@ class GanttCalendarGridComponent {
2808
2820
  }
2809
2821
  }
2810
2822
  ngOnInit() {
2811
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
2812
- merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
2813
- .pipe(takeUntil(this.unsubscribe$))
2814
- .subscribe(() => {
2815
- this.setTodayPoint();
2816
- });
2817
- });
2823
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
2824
+ merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
2825
+ .pipe(takeUntil(this.unsubscribe$))
2826
+ .subscribe(() => {
2827
+ this.setTodayPoint();
2828
+ });
2829
+ });
2830
+ }
2831
+ ngOnDestroy() {
2832
+ this.unsubscribe$.next();
2833
+ this.unsubscribe$.complete();
2834
+ }
2835
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttCalendarGridComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
2836
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: GanttCalendarGridComponent, isStandalone: true, selector: "gantt-calendar-grid", host: { properties: { "class": "this.className" } }, ngImport: i0, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n @if (ganttUpper.showTodayLine) {\n <span class=\"today-line\"> </span>\n }\n</div>\n<svg class=\"gantt-calendar-grid-fill\" [attr.width]=\"view.width\" [attr.height]=\"1\">\n <g>\n @for (point of view.secondaryDatePoints; track point.x) {\n @if (point.fill) {\n <rect [attr.x]=\"$index * view.cellWidth\" y=\"0\" [attr.width]=\"view.cellWidth\" [attr.height]=\"mainHeight\" [attr.fill]=\"point.fill\" />\n }\n }\n </g>\n</svg>\n\n<svg class=\"gantt-calendar-grid-main\" [attr.width]=\"view.width\" [attr.height]=\"ganttUpper.styles.headerHeight - 1\">\n <g>\n @if (view.showTimeline) {\n <g>\n @for (point of view.secondaryDatePoints; track point.x) {\n <line\n [attr.x1]=\"($index + 1) * view.cellWidth\"\n [attr.x2]=\"($index + 1) * view.cellWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n }\n </g>\n }\n <g>\n @for (point of view.primaryDatePoints; track point?.x) {\n @let rightX = point?.rightX ?? ($index + 1) * view.primaryWidth;\n <line [attr.x1]=\"rightX\" [attr.x2]=\"rightX\" [attr.y1]=\"0\" [attr.y2]=\"mainHeight\" class=\"primary-line\"></line>\n }\n </g>\n </g>\n</svg>\n" }); }
2837
+ }
2838
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttCalendarGridComponent, decorators: [{
2839
+ type: Component,
2840
+ args: [{ selector: 'gantt-calendar-grid', standalone: true, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n @if (ganttUpper.showTodayLine) {\n <span class=\"today-line\"> </span>\n }\n</div>\n<svg class=\"gantt-calendar-grid-fill\" [attr.width]=\"view.width\" [attr.height]=\"1\">\n <g>\n @for (point of view.secondaryDatePoints; track point.x) {\n @if (point.fill) {\n <rect [attr.x]=\"$index * view.cellWidth\" y=\"0\" [attr.width]=\"view.cellWidth\" [attr.height]=\"mainHeight\" [attr.fill]=\"point.fill\" />\n }\n }\n </g>\n</svg>\n\n<svg class=\"gantt-calendar-grid-main\" [attr.width]=\"view.width\" [attr.height]=\"ganttUpper.styles.headerHeight - 1\">\n <g>\n @if (view.showTimeline) {\n <g>\n @for (point of view.secondaryDatePoints; track point.x) {\n <line\n [attr.x1]=\"($index + 1) * view.cellWidth\"\n [attr.x2]=\"($index + 1) * view.cellWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n }\n </g>\n }\n <g>\n @for (point of view.primaryDatePoints; track point?.x) {\n @let rightX = point?.rightX ?? ($index + 1) * view.primaryWidth;\n <line [attr.x1]=\"rightX\" [attr.x2]=\"rightX\" [attr.y1]=\"0\" [attr.y2]=\"mainHeight\" class=\"primary-line\"></line>\n }\n </g>\n </g>\n</svg>\n" }]
2841
+ }], ctorParameters: () => [{ type: GanttUpper, decorators: [{
2842
+ type: Inject,
2843
+ args: [GANTT_UPPER_TOKEN]
2844
+ }] }, { type: i0.NgZone }, { type: i0.ElementRef }], propDecorators: { className: [{
2845
+ type: HostBinding,
2846
+ args: ['class']
2847
+ }] } });
2848
+
2849
+ class GanttCalendarHeaderComponent {
2850
+ get view() {
2851
+ return this.ganttUpper.view;
2852
+ }
2853
+ get height() {
2854
+ return this.ganttUpper.styles.headerHeight + 'px';
2855
+ }
2856
+ constructor(ganttUpper, ngZone, elementRef) {
2857
+ this.ganttUpper = ganttUpper;
2858
+ this.ngZone = ngZone;
2859
+ this.elementRef = elementRef;
2860
+ this.unsubscribe$ = new Subject();
2861
+ this.viewTypes = GanttViewType;
2862
+ this.className = `gantt-calendar gantt-calendar-header`;
2863
+ }
2864
+ ngOnInit() {
2865
+ // 头部日期定位
2866
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
2867
+ merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
2868
+ .pipe(takeUntil(this.unsubscribe$))
2869
+ .subscribe(() => {
2870
+ if (this.ganttUpper.viewType === GanttViewType.day)
2871
+ this.setTodayPoint();
2872
+ });
2873
+ });
2874
+ }
2875
+ setTodayPoint() {
2876
+ const x = this.view.getTodayXPoint();
2877
+ const today = new GanttDate().getDate();
2878
+ const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
2879
+ const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
2880
+ if (isNumber(x)) {
2881
+ if (rect) {
2882
+ rect.style.left = `${x - todayWidth / 2}px`;
2883
+ rect.style.top = `${this.ganttUpper.styles.headerHeight - todayHeight}px`;
2884
+ rect.innerHTML = today.toString();
2885
+ }
2886
+ }
2887
+ else {
2888
+ todayEle.style.display = 'none';
2889
+ }
2890
+ }
2891
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttCalendarHeaderComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
2892
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: GanttCalendarHeaderComponent, isStandalone: true, selector: "gantt-calendar-header", host: { properties: { "class": "this.className", "style.height": "this.height" } }, 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]=\"ganttUpper.styles.headerHeight\">\n <g>\n @for (point of view.secondaryDatePoints; track point.x) {\n @if (point.fill) {\n <rect\n [attr.x]=\"$index * view.cellWidth\"\n y=\"0\"\n [attr.width]=\"view.cellWidth\"\n [attr.height]=\"ganttUpper.styles.headerHeight\"\n [attr.fill]=\"point.fill\"\n />\n }\n <text\n class=\"secondary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n }\n\n @for (point of view.primaryDatePoints; track point.x) {\n <text\n class=\"primary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n }\n\n <g>\n @for (point of view.primaryDatePoints; track point?.x) {\n @let rightX = point?.rightX ?? ($index + 1) * view.primaryWidth;\n <line [attr.x1]=\"rightX\" [attr.x2]=\"rightX\" [attr.y1]=\"0\" [attr.y2]=\"ganttUpper.styles.headerHeight\" class=\"primary-line\"></line>\n }\n </g>\n\n <g>\n <line\n [attr.x1]=\"0\"\n [attr.x2]=\"view.width\"\n [attr.y1]=\"ganttUpper.styles.headerHeight\"\n [attr.y2]=\"ganttUpper.styles.headerHeight\"\n class=\"header-line\"\n ></line>\n </g>\n </g>\n</svg>\n", dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
2893
+ }
2894
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
2895
+ type: Component,
2896
+ args: [{ selector: 'gantt-calendar-header', imports: [NgStyle], 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]=\"ganttUpper.styles.headerHeight\">\n <g>\n @for (point of view.secondaryDatePoints; track point.x) {\n @if (point.fill) {\n <rect\n [attr.x]=\"$index * view.cellWidth\"\n y=\"0\"\n [attr.width]=\"view.cellWidth\"\n [attr.height]=\"ganttUpper.styles.headerHeight\"\n [attr.fill]=\"point.fill\"\n />\n }\n <text\n class=\"secondary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n }\n\n @for (point of view.primaryDatePoints; track point.x) {\n <text\n class=\"primary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n }\n\n <g>\n @for (point of view.primaryDatePoints; track point?.x) {\n @let rightX = point?.rightX ?? ($index + 1) * view.primaryWidth;\n <line [attr.x1]=\"rightX\" [attr.x2]=\"rightX\" [attr.y1]=\"0\" [attr.y2]=\"ganttUpper.styles.headerHeight\" class=\"primary-line\"></line>\n }\n </g>\n\n <g>\n <line\n [attr.x1]=\"0\"\n [attr.x2]=\"view.width\"\n [attr.y1]=\"ganttUpper.styles.headerHeight\"\n [attr.y2]=\"ganttUpper.styles.headerHeight\"\n class=\"header-line\"\n ></line>\n </g>\n </g>\n</svg>\n" }]
2897
+ }], ctorParameters: () => [{ type: GanttUpper, decorators: [{
2898
+ type: Inject,
2899
+ args: [GANTT_UPPER_TOKEN]
2900
+ }] }, { type: i0.NgZone }, { type: i0.ElementRef }], propDecorators: { className: [{
2901
+ type: HostBinding,
2902
+ args: ['class']
2903
+ }], height: [{
2904
+ type: HostBinding,
2905
+ args: ['style.height']
2906
+ }] } });
2907
+
2908
+ class GanttDragBackdropComponent {
2909
+ constructor(ganttUpper) {
2910
+ this.ganttUpper = ganttUpper;
2911
+ }
2912
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttDragBackdropComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component }); }
2913
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.3", type: GanttDragBackdropComponent, isStandalone: true, selector: "gantt-drag-backdrop", host: { classAttribute: "gantt-drag-backdrop" }, ngImport: i0, template: "<div class=\"gantt-drag-mask\" [style.top.px]=\"ganttUpper.styles.headerHeight\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n" }); }
2914
+ }
2915
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
2916
+ type: Component,
2917
+ args: [{ selector: 'gantt-drag-backdrop', host: {
2918
+ class: 'gantt-drag-backdrop'
2919
+ }, standalone: true, template: "<div class=\"gantt-drag-mask\" [style.top.px]=\"ganttUpper.styles.headerHeight\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n" }]
2920
+ }], ctorParameters: () => [{ type: GanttUpper, decorators: [{
2921
+ type: Inject,
2922
+ args: [GANTT_UPPER_TOKEN]
2923
+ }] }] });
2924
+
2925
+ class GanttLoaderComponent {
2926
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2927
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.3", type: GanttLoaderComponent, isStandalone: true, selector: "gantt-loader", host: { classAttribute: "gantt-loader gantt-loader-overlay" }, ngImport: i0, template: `
2928
+ <div class="gantt-loader-wrapper">
2929
+ <div class="gantt-loader-loading">
2930
+ <span class="gantt-loader-loading-spot"></span>
2931
+ </div>
2932
+ </div>
2933
+ `, isInline: true }); }
2934
+ }
2935
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttLoaderComponent, decorators: [{
2936
+ type: Component,
2937
+ args: [{
2938
+ selector: 'gantt-loader',
2939
+ template: `
2940
+ <div class="gantt-loader-wrapper">
2941
+ <div class="gantt-loader-loading">
2942
+ <span class="gantt-loader-loading-spot"></span>
2943
+ </div>
2944
+ </div>
2945
+ `,
2946
+ host: {
2947
+ class: 'gantt-loader gantt-loader-overlay'
2948
+ },
2949
+ standalone: true
2950
+ }]
2951
+ }] });
2952
+
2953
+ class NgxGanttRangeComponent extends GanttItemUpper {
2954
+ constructor(elementRef, ganttUpper) {
2955
+ super(elementRef, ganttUpper);
2956
+ this.ganttRangeClass = true;
2957
+ }
2958
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: NgxGanttRangeComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component }); }
2959
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: NgxGanttRangeComponent, isStandalone: true, selector: "ngx-gantt-range,gantt-range", host: { properties: { "class.gantt-range": "this.ganttRangeClass" } }, usesInheritance: true, ngImport: i0, template: "@if (item.start && item.end) {\n <div class=\"gantt-range-main\">\n @if (item.progress >= 0) {\n <div class=\"gantt-range-main-progress\" [style.width.%]=\"item.progress * 100\"></div>\n }\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}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
2960
+ }
2961
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2962
+ type: Component,
2963
+ args: [{ selector: 'ngx-gantt-range,gantt-range', imports: [NgTemplateOutlet], template: "@if (item.start && item.end) {\n <div class=\"gantt-range-main\">\n @if (item.progress >= 0) {\n <div class=\"gantt-range-main-progress\" [style.width.%]=\"item.progress * 100\"></div>\n }\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}\n" }]
2964
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
2965
+ type: Inject,
2966
+ args: [GANTT_UPPER_TOKEN]
2967
+ }] }], propDecorators: { ganttRangeClass: [{
2968
+ type: HostBinding,
2969
+ args: ['class.gantt-range']
2970
+ }] } });
2971
+
2972
+ class GanttSyncScrollService {
2973
+ constructor() {
2974
+ this.ngZone = inject(NgZone);
2975
+ this.scrollGroupsMap = new Map();
2976
+ }
2977
+ registerScrollEvent(groupName, element, direction) {
2978
+ const group = this.scrollGroupsMap.get(groupName) || { elements: [], destroy$: new Subject(), direction };
2979
+ group.elements.push(element);
2980
+ this.scrollGroupsMap.set(groupName, group);
2981
+ this.monitorScrollChange(group);
2982
+ }
2983
+ unregisterScrollEvent(groupName, element) {
2984
+ const group = this.scrollGroupsMap.get(groupName);
2985
+ if (group) {
2986
+ group.elements = group.elements.filter((el) => el !== element);
2987
+ if (!group.elements.length) {
2988
+ this.scrollGroupsMap.delete(groupName);
2989
+ }
2990
+ else {
2991
+ this.scrollGroupsMap.set(groupName, group);
2992
+ }
2993
+ this.monitorScrollChange(group);
2994
+ }
2995
+ }
2996
+ monitorScrollChange(group) {
2997
+ const { elements, destroy$, direction } = group;
2998
+ destroy$.next();
2999
+ destroy$.complete();
3000
+ if (elements.length) {
3001
+ const scrollObservers = elements.map((el) => fromEvent(el, 'scroll', passiveListenerOptions));
3002
+ this.ngZone.runOutsideAngular(() => merge(...scrollObservers)
3003
+ .pipe(takeUntil$1(destroy$))
3004
+ .subscribe((event) => {
3005
+ elements.forEach((el) => {
3006
+ if (direction === 'x') {
3007
+ el.scrollLeft = event.currentTarget.scrollLeft;
3008
+ }
3009
+ else {
3010
+ el.scrollTop = event.currentTarget.scrollTop;
3011
+ }
3012
+ });
3013
+ }));
3014
+ }
3015
+ }
3016
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3017
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollService }); }
3018
+ }
3019
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollService, decorators: [{
3020
+ type: Injectable
3021
+ }], ctorParameters: () => [] });
3022
+
3023
+ class GanttSyncScrollXDirective {
3024
+ constructor() {
3025
+ this.syncScrollX = input();
3026
+ this.elementRef = inject((ElementRef));
3027
+ this.syncScrollService = inject(GanttSyncScrollService);
3028
+ }
3029
+ ngOnInit() {
3030
+ this.syncScrollService.registerScrollEvent(this.syncScrollX(), this.elementRef.nativeElement, 'x');
2818
3031
  }
2819
3032
  ngOnDestroy() {
2820
- this.unsubscribe$.next();
2821
- this.unsubscribe$.complete();
3033
+ this.syncScrollService.unregisterScrollEvent(this.syncScrollX(), this.elementRef.nativeElement);
2822
3034
  }
2823
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttCalendarGridComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
2824
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: GanttCalendarGridComponent, isStandalone: true, selector: "gantt-calendar-grid", host: { properties: { "class": "this.className" } }, ngImport: i0, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n @if (ganttUpper.showTodayLine) {\n <span class=\"today-line\"> </span>\n }\n</div>\n<svg class=\"gantt-calendar-grid-fill\" [attr.width]=\"view.width\" [attr.height]=\"1\">\n <g>\n @for (point of view.secondaryDatePoints; track point.x) {\n @if (point.fill) {\n <rect [attr.x]=\"$index * view.cellWidth\" y=\"0\" [attr.width]=\"view.cellWidth\" [attr.height]=\"mainHeight\" [attr.fill]=\"point.fill\" />\n }\n }\n </g>\n</svg>\n\n<svg class=\"gantt-calendar-grid-main\" [attr.width]=\"view.width\" [attr.height]=\"ganttUpper.styles.headerHeight - 1\">\n <g>\n @if (view.showTimeline) {\n <g>\n @for (point of view.secondaryDatePoints; track point.x) {\n <line\n [attr.x1]=\"($index + 1) * view.cellWidth\"\n [attr.x2]=\"($index + 1) * view.cellWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n }\n </g>\n }\n <g>\n @for (point of view.primaryDatePoints; track point.x) {\n <line\n [attr.x1]=\"($index + 1) * view.primaryWidth\"\n [attr.x2]=\"($index + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n }\n </g>\n </g>\n</svg>\n" }); }
3035
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollXDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3036
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.3", type: GanttSyncScrollXDirective, isStandalone: true, selector: "[syncScrollX]", inputs: { syncScrollX: { classPropertyName: "syncScrollX", publicName: "syncScrollX", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
2825
3037
  }
2826
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttCalendarGridComponent, decorators: [{
2827
- type: Component,
2828
- args: [{ selector: 'gantt-calendar-grid', standalone: true, template: "<div class=\"gantt-calendar-today-overlay\" [style.width.px]=\"view.width\">\n @if (ganttUpper.showTodayLine) {\n <span class=\"today-line\"> </span>\n }\n</div>\n<svg class=\"gantt-calendar-grid-fill\" [attr.width]=\"view.width\" [attr.height]=\"1\">\n <g>\n @for (point of view.secondaryDatePoints; track point.x) {\n @if (point.fill) {\n <rect [attr.x]=\"$index * view.cellWidth\" y=\"0\" [attr.width]=\"view.cellWidth\" [attr.height]=\"mainHeight\" [attr.fill]=\"point.fill\" />\n }\n }\n </g>\n</svg>\n\n<svg class=\"gantt-calendar-grid-main\" [attr.width]=\"view.width\" [attr.height]=\"ganttUpper.styles.headerHeight - 1\">\n <g>\n @if (view.showTimeline) {\n <g>\n @for (point of view.secondaryDatePoints; track point.x) {\n <line\n [attr.x1]=\"($index + 1) * view.cellWidth\"\n [attr.x2]=\"($index + 1) * view.cellWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"secondary-line\"\n ></line>\n }\n </g>\n }\n <g>\n @for (point of view.primaryDatePoints; track point.x) {\n <line\n [attr.x1]=\"($index + 1) * view.primaryWidth\"\n [attr.x2]=\"($index + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"mainHeight\"\n class=\"primary-line\"\n ></line>\n }\n </g>\n </g>\n</svg>\n" }]
2829
- }], ctorParameters: () => [{ type: GanttUpper, decorators: [{
2830
- type: Inject,
2831
- args: [GANTT_UPPER_TOKEN]
2832
- }] }, { type: i0.NgZone }, { type: i0.ElementRef }], propDecorators: { className: [{
2833
- type: HostBinding,
2834
- args: ['class']
2835
- }] } });
2836
-
2837
- class GanttCalendarHeaderComponent {
2838
- get view() {
2839
- return this.ganttUpper.view;
2840
- }
2841
- get height() {
2842
- return this.ganttUpper.styles.headerHeight + 'px';
2843
- }
2844
- constructor(ganttUpper, ngZone, elementRef) {
2845
- this.ganttUpper = ganttUpper;
2846
- this.ngZone = ngZone;
2847
- this.elementRef = elementRef;
2848
- this.unsubscribe$ = new Subject();
2849
- this.viewTypes = GanttViewType;
2850
- this.className = `gantt-calendar gantt-calendar-header`;
3038
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollXDirective, decorators: [{
3039
+ type: Directive,
3040
+ args: [{
3041
+ selector: '[syncScrollX]',
3042
+ standalone: true
3043
+ }]
3044
+ }], ctorParameters: () => [] });
3045
+ class GanttSyncScrollYDirective {
3046
+ constructor() {
3047
+ this.syncScrollY = input();
3048
+ this.syncScrollService = inject(GanttSyncScrollService);
3049
+ this.elementRef = inject((ElementRef));
2851
3050
  }
2852
3051
  ngOnInit() {
2853
- // 头部日期定位
2854
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
2855
- merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
2856
- .pipe(takeUntil(this.unsubscribe$))
2857
- .subscribe(() => {
2858
- if (this.ganttUpper.viewType === GanttViewType.day)
2859
- this.setTodayPoint();
2860
- });
2861
- });
3052
+ this.syncScrollService.registerScrollEvent(this.syncScrollY(), this.elementRef.nativeElement, 'y');
2862
3053
  }
2863
- setTodayPoint() {
2864
- const x = this.view.getTodayXPoint();
2865
- const today = new GanttDate().getDate();
2866
- const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
2867
- const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
2868
- if (isNumber(x)) {
2869
- if (rect) {
2870
- rect.style.left = `${x - todayWidth / 2}px`;
2871
- rect.style.top = `${this.ganttUpper.styles.headerHeight - todayHeight}px`;
2872
- rect.innerHTML = today.toString();
2873
- }
2874
- }
2875
- else {
2876
- todayEle.style.display = 'none';
2877
- }
3054
+ ngOnDestroy() {
3055
+ this.syncScrollService.unregisterScrollEvent(this.syncScrollY(), this.elementRef.nativeElement);
2878
3056
  }
2879
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttCalendarHeaderComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.NgZone }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
2880
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: GanttCalendarHeaderComponent, isStandalone: true, selector: "gantt-calendar-header", host: { properties: { "class": "this.className", "style.height": "this.height" } }, 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]=\"ganttUpper.styles.headerHeight\">\n <g>\n @for (point of view.secondaryDatePoints; track point.x) {\n @if (point.fill) {\n <rect\n [attr.x]=\"$index * view.cellWidth\"\n y=\"0\"\n [attr.width]=\"view.cellWidth\"\n [attr.height]=\"ganttUpper.styles.headerHeight\"\n [attr.fill]=\"point.fill\"\n />\n }\n <text\n class=\"secondary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n }\n\n @for (point of view.primaryDatePoints; track point.x) {\n <text\n class=\"primary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n }\n\n <g>\n @for (point of view.primaryDatePoints; track point.x) {\n <line\n [attr.x1]=\"($index + 1) * view.primaryWidth\"\n [attr.x2]=\"($index + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"ganttUpper.styles.headerHeight\"\n class=\"primary-line\"\n ></line>\n }\n </g>\n\n <g>\n <line\n [attr.x1]=\"0\"\n [attr.x2]=\"view.width\"\n [attr.y1]=\"ganttUpper.styles.headerHeight\"\n [attr.y2]=\"ganttUpper.styles.headerHeight\"\n class=\"header-line\"\n ></line>\n </g>\n </g>\n</svg>\n", dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
3057
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollYDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3058
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.3", type: GanttSyncScrollYDirective, isStandalone: true, selector: "[syncScrollY]", inputs: { syncScrollY: { classPropertyName: "syncScrollY", publicName: "syncScrollY", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
2881
3059
  }
2882
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
3060
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollYDirective, decorators: [{
3061
+ type: Directive,
3062
+ args: [{
3063
+ selector: '[syncScrollY]',
3064
+ standalone: true
3065
+ }]
3066
+ }], ctorParameters: () => [] });
3067
+
3068
+ class GanttScrollbarComponent {
3069
+ constructor(ganttUpper) {
3070
+ this.ganttUpper = ganttUpper;
3071
+ this.hasFooter = input(false);
3072
+ this.tableWidth = input();
3073
+ this.ganttRoot = input();
3074
+ this.tableScrollWidth = input(0);
3075
+ }
3076
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttScrollbarComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component }); }
3077
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.3", type: GanttScrollbarComponent, isStandalone: true, selector: "gantt-scrollbar", inputs: { hasFooter: { classPropertyName: "hasFooter", publicName: "hasFooter", isSignal: true, isRequired: false, transformFunction: null }, tableWidth: { classPropertyName: "tableWidth", publicName: "tableWidth", isSignal: true, isRequired: false, transformFunction: null }, ganttRoot: { classPropertyName: "ganttRoot", publicName: "ganttRoot", isSignal: true, isRequired: false, transformFunction: null }, tableScrollWidth: { classPropertyName: "tableScrollWidth", publicName: "tableScrollWidth", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div\n class=\"gantt-scrollbar\"\n [ngClass]=\"{ 'gantt-scrollbar-bg': hasFooter() }\"\n [style.height.px]=\"ganttRoot()?.horizontalScrollbarHeight + 1\"\n [style.right.px]=\"ganttRoot()?.verticalScrollbarWidth\"\n>\n <div\n class=\"gantt-table-scrollbar\"\n syncScrollX=\"ganttTableXScroll\"\n [class.with-scrollbar]=\"ganttRoot()?.horizontalScrollbarHeight\"\n [style.width.px]=\"tableWidth()\"\n >\n <div class=\"h-100\" [style.width.px]=\"tableScrollWidth() - 1\"></div>\n </div>\n <div class=\"gantt-main-scrollbar\" syncScrollX=\"ganttMainXScroll\">\n <div class=\"h-100\" [style.width.px]=\"ganttRoot()['view']?.width\"></div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: GanttSyncScrollXDirective, selector: "[syncScrollX]", inputs: ["syncScrollX"] }] }); }
3078
+ }
3079
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttScrollbarComponent, decorators: [{
2883
3080
  type: Component,
2884
- args: [{ selector: 'gantt-calendar-header', imports: [NgStyle], 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]=\"ganttUpper.styles.headerHeight\">\n <g>\n @for (point of view.secondaryDatePoints; track point.x) {\n @if (point.fill) {\n <rect\n [attr.x]=\"$index * view.cellWidth\"\n y=\"0\"\n [attr.width]=\"view.cellWidth\"\n [attr.height]=\"ganttUpper.styles.headerHeight\"\n [attr.fill]=\"point.fill\"\n />\n }\n <text\n class=\"secondary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n }\n\n @for (point of view.primaryDatePoints; track point.x) {\n <text\n class=\"primary-text\"\n [ngStyle]=\"point.style\"\n [class.today]=\"point.additions?.isToday\"\n [class.weekend]=\"point.additions?.isWeekend\"\n [attr.x]=\"point.x\"\n [attr.y]=\"point.y\"\n >\n {{ point.text }}\n </text>\n }\n\n <g>\n @for (point of view.primaryDatePoints; track point.x) {\n <line\n [attr.x1]=\"($index + 1) * view.primaryWidth\"\n [attr.x2]=\"($index + 1) * view.primaryWidth\"\n [attr.y1]=\"0\"\n [attr.y2]=\"ganttUpper.styles.headerHeight\"\n class=\"primary-line\"\n ></line>\n }\n </g>\n\n <g>\n <line\n [attr.x1]=\"0\"\n [attr.x2]=\"view.width\"\n [attr.y1]=\"ganttUpper.styles.headerHeight\"\n [attr.y2]=\"ganttUpper.styles.headerHeight\"\n class=\"header-line\"\n ></line>\n </g>\n </g>\n</svg>\n" }]
3081
+ args: [{ selector: 'gantt-scrollbar', imports: [NgClass, GanttSyncScrollXDirective], template: "<div\n class=\"gantt-scrollbar\"\n [ngClass]=\"{ 'gantt-scrollbar-bg': hasFooter() }\"\n [style.height.px]=\"ganttRoot()?.horizontalScrollbarHeight + 1\"\n [style.right.px]=\"ganttRoot()?.verticalScrollbarWidth\"\n>\n <div\n class=\"gantt-table-scrollbar\"\n syncScrollX=\"ganttTableXScroll\"\n [class.with-scrollbar]=\"ganttRoot()?.horizontalScrollbarHeight\"\n [style.width.px]=\"tableWidth()\"\n >\n <div class=\"h-100\" [style.width.px]=\"tableScrollWidth() - 1\"></div>\n </div>\n <div class=\"gantt-main-scrollbar\" syncScrollX=\"ganttMainXScroll\">\n <div class=\"h-100\" [style.width.px]=\"ganttRoot()['view']?.width\"></div>\n </div>\n</div>\n" }]
2885
3082
  }], ctorParameters: () => [{ type: GanttUpper, decorators: [{
2886
3083
  type: Inject,
2887
3084
  args: [GANTT_UPPER_TOKEN]
2888
- }] }, { type: i0.NgZone }, { type: i0.ElementRef }], propDecorators: { className: [{
2889
- type: HostBinding,
2890
- args: ['class']
2891
- }], height: [{
2892
- type: HostBinding,
2893
- args: ['style.height']
2894
- }] } });
3085
+ }] }] });
2895
3086
 
2896
- class GanttDragBackdropComponent {
3087
+ class NgxGanttToolbarComponent {
3088
+ get top() {
3089
+ return this.ganttUpper.styles.headerHeight + 16 + 'px';
3090
+ }
2897
3091
  constructor(ganttUpper) {
2898
3092
  this.ganttUpper = ganttUpper;
3093
+ this.ganttItemClass = true;
3094
+ this.views = inject(GanttConfigService).getViewsLocale();
2899
3095
  }
2900
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttDragBackdropComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component }); }
2901
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.3", type: GanttDragBackdropComponent, isStandalone: true, selector: "gantt-drag-backdrop", host: { classAttribute: "gantt-drag-backdrop" }, ngImport: i0, template: "<div class=\"gantt-drag-mask\" [style.top.px]=\"ganttUpper.styles.headerHeight\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n" }); }
3096
+ selectView(view) {
3097
+ this.ganttUpper.changeView(view);
3098
+ }
3099
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: NgxGanttToolbarComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component }); }
3100
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: NgxGanttToolbarComponent, isStandalone: true, selector: "ngx-gantt-toolbar,gantt-toolbar", inputs: { template: "template" }, host: { properties: { "class.gantt-toolbar": "this.ganttItemClass", "style.top": "this.top" } }, ngImport: i0, template: "<div class=\"toolbar-container\">\n @if (!template) {\n @if (this.ganttUpper.toolbarOptions?.viewTypes?.length) {\n <div class=\"toolbar-views\">\n @for (viewType of this.ganttUpper.toolbarOptions?.viewTypes; track viewType) {\n @if (views[viewType]) {\n <div class=\"toolbar-view\" [class.active]=\"viewType === this.ganttUpper.viewType\" (click)=\"selectView(viewType)\">\n {{ views[viewType].label }}\n </div>\n }\n }\n </div>\n }\n }\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
2902
3101
  }
2903
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
3102
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
2904
3103
  type: Component,
2905
- args: [{ selector: 'gantt-drag-backdrop', host: {
2906
- class: 'gantt-drag-backdrop'
2907
- }, standalone: true, template: "<div class=\"gantt-drag-mask\" [style.top.px]=\"ganttUpper.styles.headerHeight\">\n <div class=\"date-range\">\n <span class=\"start\"></span>\n <span class=\"end\"></span>\n </div>\n</div>\n" }]
3104
+ args: [{ selector: 'ngx-gantt-toolbar,gantt-toolbar', imports: [NgTemplateOutlet], template: "<div class=\"toolbar-container\">\n @if (!template) {\n @if (this.ganttUpper.toolbarOptions?.viewTypes?.length) {\n <div class=\"toolbar-views\">\n @for (viewType of this.ganttUpper.toolbarOptions?.viewTypes; track viewType) {\n @if (views[viewType]) {\n <div class=\"toolbar-view\" [class.active]=\"viewType === this.ganttUpper.viewType\" (click)=\"selectView(viewType)\">\n {{ views[viewType].label }}\n </div>\n }\n }\n </div>\n }\n }\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\n" }]
2908
3105
  }], ctorParameters: () => [{ type: GanttUpper, decorators: [{
2909
3106
  type: Inject,
2910
3107
  args: [GANTT_UPPER_TOKEN]
2911
- }] }] });
3108
+ }] }], propDecorators: { template: [{
3109
+ type: Input
3110
+ }], ganttItemClass: [{
3111
+ type: HostBinding,
3112
+ args: ['class.gantt-toolbar']
3113
+ }], top: [{
3114
+ type: HostBinding,
3115
+ args: ['style.top']
3116
+ }] } });
2912
3117
 
2913
- 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>`;
2914
- 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>`;
2915
- 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>`;
2916
- 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>`;
2917
- 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">
2918
- <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)">
2919
- <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform>
2920
- </path>
2921
- </svg>`;
2922
- const emptyIcon = `<svg
2923
- width="148px"
2924
- height="134px"
2925
- viewBox="0 0 148 134"
2926
- version="1.1"
2927
- xmlns="http://www.w3.org/2000/svg"
2928
- xmlns:xlink="http://www.w3.org/1999/xlink"
2929
- >
2930
- <defs>
2931
- <filter x="0.0%" y="0.0%" width="100.0%" height="100.0%" filterUnits="objectBoundingBox" id="filter-1">
2932
- <feGaussianBlur stdDeviation="0" in="SourceGraphic"></feGaussianBlur>
2933
- </filter>
2934
- </defs>
2935
- <g id="148x134" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
2936
- <g id="编组-6" transform="translate(1.000000, 1.000000)">
2937
- <ellipse
2938
- id="椭圆形"
2939
- fill="#EDEEF2"
2940
- opacity="0.3"
2941
- filter="url(#filter-1)"
2942
- cx="73.0800017"
2943
- cy="115.920003"
2944
- rx="73.0800017"
2945
- ry="16.8000004"
2946
- ></ellipse>
2947
- <g id="编组-5" transform="translate(15.120000, 0.000000)">
2948
- <polygon
2949
- id="矩形"
2950
- fill="#E2E4E9"
2951
- points="19.2789848 49.5600011 99.1200023 48.7200011 117.600003 75.9297673 117.600003 92.313049 0 92.313049 0 75.0356267"
2952
- ></polygon>
2953
- <path
2954
- 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"
2955
- id="矩形"
2956
- fill="#F9FAFB"
2957
- ></path>
2958
- <path
2959
- 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"
2960
- id="矩形"
2961
- fill="#E8EAEE"
2962
- ></path>
2963
- <text
2964
- id="&lt;/null&gt;"
2965
- font-family="PingFangSC-Medium, PingFang SC"
2966
- font-size="15.1200003"
2967
- font-weight="400"
2968
- fill="#BCBECD"
2969
- >
2970
- <tspan x="33.6000008" y="32.8000004">&lt;/null&gt;</tspan>
2971
- </text>
2972
- <rect id="矩形" fill="#E8EAEE" x="27.5600006" y="52.0800012" width="61.4800014" height="5.04000011" rx="2.52000006"></rect>
2973
- <rect
2974
- id="矩形备份"
2975
- fill="#E8EAEE"
2976
- x="27.5600006"
2977
- y="63.8400014"
2978
- width="61.4800014"
2979
- height="5.04000011"
2980
- rx="2.52000006"
2981
- ></rect>
2982
- <path
2983
- 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"
2984
- id="矩形"
2985
- fill="#EDEFF2"
2986
- ></path>
2987
- </g>
2988
- </g>
2989
- </g>
2990
- </svg>`;
2991
- const dragIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="aijaction/drag--" stroke-width="1" fill-rule="evenodd"><g id="aij拖动" transform="translate(5 1)" fill-rule="nonzero"><path d="M1 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zM1 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-4 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-4 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2z" id="aij形状结合"></path></g></g></svg>`;
2992
- const arrowLeftIcon = `<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" height="1em" width="1em" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="adinavigation/arrow-left" stroke-width="1" fill-rule="evenodd"><path d="M7.4 4.15L4.438 7.315a.6.6 0 0 1-.876-.82l3.97-4.243a.598.598 0 0 1 .93-.057l3.97 4.323a.6.6 0 1 1-.885.812L8.6 4.118v9.149c0 .404-.269.733-.6.733-.332 0-.6-.329-.6-.733V4.15z" id="adi形状结合" transform="rotate(-90 7.995 8)"></path></g></svg>`;
2993
- const arrowRightIcon = `<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" height="1em" width="1em" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="adlnavigation/arrow-right" stroke-width="1" fill-rule="evenodd"><path d="M7.4 4.15L4.438 7.315a.6.6 0 0 1-.876-.82l3.97-4.243a.598.598 0 0 1 .93-.057l3.97 4.323a.6.6 0 1 1-.885.812L8.6 4.118v9.149c0 .404-.269.733-.6.733-.332 0-.6-.329-.6-.733V4.15z" id="adl形状结合" transform="rotate(90 7.995 8)"></path></g></svg>`;
2994
- const icons = {
2995
- 'angle-right': angleRight,
2996
- 'angle-down': angleDown,
2997
- 'plus-square': plusSquare,
2998
- 'minus-square': minusSquare,
2999
- loading: loadingIcon,
3000
- empty: emptyIcon,
3001
- drag: dragIcon,
3002
- 'arrow-left': arrowLeftIcon,
3003
- 'arrow-right': arrowRightIcon
3004
- };
3118
+ class GanttPrintService {
3119
+ constructor() { }
3120
+ setInlineStyles(targetElem) {
3121
+ const svgElements = Array.from(targetElem.getElementsByTagName('svg'));
3122
+ for (const svgElement of svgElements) {
3123
+ this.recursElementChildren(svgElement);
3124
+ }
3125
+ }
3126
+ recursElementChildren(node) {
3127
+ const transformProperties = [
3128
+ 'fill',
3129
+ 'color',
3130
+ 'font-size',
3131
+ 'stroke',
3132
+ 'font',
3133
+ 'text-anchor',
3134
+ 'stroke-dasharray',
3135
+ 'shape-rendering',
3136
+ 'stroke-width'
3137
+ ];
3138
+ if (!node.style) {
3139
+ return;
3140
+ }
3141
+ const styles = getComputedStyle(node);
3142
+ for (const transformProperty of transformProperties) {
3143
+ node.style[transformProperty] = styles[transformProperty];
3144
+ }
3145
+ for (const child of Array.from(node.childNodes)) {
3146
+ this.recursElementChildren(child);
3147
+ }
3148
+ }
3149
+ register(root) {
3150
+ this.root = root.nativeElement;
3151
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
3152
+ }
3153
+ async print(name = 'download', ignoreElementClass) {
3154
+ const root = this.root;
3155
+ const mainContainer = this.mainContainer;
3156
+ // set print width
3157
+ const printWidth = root.offsetWidth;
3158
+ // set print height
3159
+ const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
3160
+ const html2canvas = (await import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')).default;
3161
+ html2canvas(root, {
3162
+ logging: false,
3163
+ allowTaint: true,
3164
+ useCORS: true,
3165
+ width: printWidth,
3166
+ height: printHeight,
3167
+ ignoreElements: (element) => {
3168
+ if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
3169
+ return true;
3170
+ }
3171
+ if (element.classList.contains('gantt-calendar-today-overlay')) {
3172
+ return true;
3173
+ }
3174
+ },
3175
+ onclone: (cloneDocument) => {
3176
+ const ganttClass = root.className;
3177
+ const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
3178
+ const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
3179
+ const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-grid-main');
3180
+ const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
3181
+ // change targetDom width
3182
+ cloneGanttDom.style.width = `${printWidth}px`;
3183
+ cloneGanttDom.style.height = `${printHeight}px`;
3184
+ cloneGanttDom.style.overflow = `unset`;
3185
+ cloneGanttContainerDom.style.backgroundColor = '#fff';
3186
+ cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
3187
+ cloneCalendarOverlay.setAttribute('style', `background: transparent`);
3188
+ if (cloneLinksOverlay) {
3189
+ cloneLinksOverlay.setAttribute('height', `${printHeight}`);
3190
+ cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
3191
+ }
3192
+ // setInlineStyles for svg
3193
+ this.setInlineStyles(cloneGanttDom);
3194
+ }
3195
+ }).then((canvas) => {
3196
+ const link = document.createElement('a');
3197
+ const dataUrl = canvas.toDataURL('image/png');
3198
+ link.download = `${name}.png`;
3199
+ link.href = dataUrl;
3200
+ link.click();
3201
+ });
3202
+ }
3203
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3204
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttPrintService }); }
3205
+ }
3206
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttPrintService, decorators: [{
3207
+ type: Injectable
3208
+ }], ctorParameters: () => [] });
3005
3209
 
3006
- class GanttIconComponent {
3007
- set iconName(name) {
3008
- this.setSvg(name);
3210
+ class IsGanttRangeItemPipe {
3211
+ transform(value) {
3212
+ return value === GanttItemType.range;
3009
3213
  }
3010
- constructor(elementRef) {
3011
- this.elementRef = elementRef;
3012
- this.isIcon = true;
3214
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3215
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.3", ngImport: i0, type: IsGanttRangeItemPipe, isStandalone: true, name: "isGanttRangeItem" }); }
3216
+ }
3217
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
3218
+ type: Pipe,
3219
+ args: [{
3220
+ name: 'isGanttRangeItem',
3221
+ standalone: true
3222
+ }]
3223
+ }] });
3224
+ class IsGanttBarItemPipe {
3225
+ transform(value) {
3226
+ return value === GanttItemType.bar;
3013
3227
  }
3014
- setSvg(name) {
3015
- const iconSvg = icons[name];
3016
- if (iconSvg) {
3017
- this.elementRef.nativeElement.innerHTML = iconSvg;
3018
- }
3019
- else {
3020
- this.elementRef.nativeElement.innerHTML = '';
3021
- }
3228
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3229
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.3", ngImport: i0, type: IsGanttBarItemPipe, isStandalone: true, name: "isGanttBarItem" }); }
3230
+ }
3231
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
3232
+ type: Pipe,
3233
+ args: [{
3234
+ name: 'isGanttBarItem',
3235
+ standalone: true
3236
+ }]
3237
+ }] });
3238
+ class IsGanttCustomItemPipe {
3239
+ transform(value) {
3240
+ return value === GanttItemType.custom;
3022
3241
  }
3023
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
3024
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.3", type: GanttIconComponent, isStandalone: true, selector: "gantt-icon", inputs: { iconName: "iconName" }, host: { properties: { "class.gantt-icon": "this.isIcon" } }, ngImport: i0, template: '', isInline: true }); }
3242
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3243
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.3", ngImport: i0, type: IsGanttCustomItemPipe, isStandalone: true, name: "isGanttCustomItem" }); }
3025
3244
  }
3026
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttIconComponent, decorators: [{
3027
- type: Component,
3245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
3246
+ type: Pipe,
3028
3247
  args: [{
3029
- selector: 'gantt-icon',
3030
- template: '',
3248
+ name: 'isGanttCustomItem',
3031
3249
  standalone: true
3032
3250
  }]
3033
- }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { isIcon: [{
3034
- type: HostBinding,
3035
- args: ['class.gantt-icon']
3036
- }], iconName: [{
3037
- type: Input
3038
- }] } });
3251
+ }] });
3252
+ class IsGanttGroupPipe {
3253
+ transform(data) {
3254
+ return !!data.items;
3255
+ }
3256
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttGroupPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3257
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.3", ngImport: i0, type: IsGanttGroupPipe, isStandalone: true, name: "isGanttGroup" }); }
3258
+ }
3259
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttGroupPipe, decorators: [{
3260
+ type: Pipe,
3261
+ args: [{
3262
+ name: 'isGanttGroup',
3263
+ standalone: true
3264
+ }]
3265
+ }] });
3039
3266
 
3040
3267
  class GanttLinkLine {
3041
3268
  constructor() { }
@@ -3332,7 +3559,19 @@ class GanttLinksComponent {
3332
3559
  if (target && (target.origin.start || target.origin.end)) {
3333
3560
  let defaultColor = LinkColors.default;
3334
3561
  let activeColor = LinkColors.active;
3335
- if (link.type === GanttLinkType.fs && source.end.getTime() > target.start.getTime()) {
3562
+ if (link.type === GanttLinkType.ff && source.end.getTime() > target.end.getTime()) {
3563
+ defaultColor = LinkColors.blocked;
3564
+ activeColor = LinkColors.blocked;
3565
+ }
3566
+ else if (link.type === GanttLinkType.fs && source.end.getTime() > target.start.getTime()) {
3567
+ defaultColor = LinkColors.blocked;
3568
+ activeColor = LinkColors.blocked;
3569
+ }
3570
+ else if (link.type === GanttLinkType.sf && source.start.getTime() > target.end.getTime()) {
3571
+ defaultColor = LinkColors.blocked;
3572
+ activeColor = LinkColors.blocked;
3573
+ }
3574
+ else if (link.type === GanttLinkType.ss && source.start.getTime() > target.start.getTime()) {
3336
3575
  defaultColor = LinkColors.blocked;
3337
3576
  activeColor = LinkColors.blocked;
3338
3577
  }
@@ -3363,147 +3602,170 @@ class GanttLinksComponent {
3363
3602
  trackBy(index) {
3364
3603
  return index;
3365
3604
  }
3366
- onLineClick(event, link) {
3367
- this.lineClick.emit({
3368
- event,
3369
- source: link.source,
3370
- target: link.target
3371
- });
3605
+ onLineClick(event, link) {
3606
+ this.lineClick.emit({
3607
+ event,
3608
+ source: link.source,
3609
+ target: link.target
3610
+ });
3611
+ }
3612
+ mouseEnterPath(link, index) {
3613
+ link.color = link.activeColor || link.defaultColor;
3614
+ if (index < this.links.length - 1) {
3615
+ this.links.splice(index, 1);
3616
+ this.links.push(link);
3617
+ }
3618
+ }
3619
+ mouseLeavePath(link) {
3620
+ link.color = link.defaultColor;
3621
+ }
3622
+ ngOnDestroy() {
3623
+ this.unsubscribe$.next();
3624
+ this.unsubscribe$.complete();
3625
+ }
3626
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttLinksComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: GanttDragContainer }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
3627
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: GanttLinksComponent, isStandalone: true, selector: "gantt-links-overlay", inputs: { flatItems: "flatItems" }, 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 @for (link of links; track trackBy(i); let i = $index) {\n <ng-container>\n <path\n [attr.d]=\"link.path\"\n fill=\"transparent\"\n stroke-width=\"2\"\n [attr.stroke]=\"link.color\"\n pointer-events=\"none\"\n [attr.style]=\"link.type === ganttLinkTypes.sf ? 'marker-start: url(#triangle' + i + ')' : 'marker-end: url(#triangle' + i + ')'\"\n ></path>\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n [attr.d]=\"link.path\"\n (mouseenter)=\"mouseEnterPath(link, i)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n @if (showArrow) {\n <defs>\n @if (link.type === ganttLinkTypes.sf) {\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"180\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n } @else {\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"auto\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n }\n </defs>\n }\n </ng-container>\n }\n <line class=\"link-dragging-line\"></line>\n</svg>\n" }); }
3628
+ }
3629
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttLinksComponent, decorators: [{
3630
+ type: Component,
3631
+ args: [{ selector: 'gantt-links-overlay', imports: [], template: "<svg [attr.width]=\"ganttUpper.view.width\" class=\"gantt-links-overlay-main\">\n @for (link of links; track trackBy(i); let i = $index) {\n <ng-container>\n <path\n [attr.d]=\"link.path\"\n fill=\"transparent\"\n stroke-width=\"2\"\n [attr.stroke]=\"link.color\"\n pointer-events=\"none\"\n [attr.style]=\"link.type === ganttLinkTypes.sf ? 'marker-start: url(#triangle' + i + ')' : 'marker-end: url(#triangle' + i + ')'\"\n ></path>\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n [attr.d]=\"link.path\"\n (mouseenter)=\"mouseEnterPath(link, i)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n @if (showArrow) {\n <defs>\n @if (link.type === ganttLinkTypes.sf) {\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"180\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n } @else {\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"auto\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n }\n </defs>\n }\n </ng-container>\n }\n <line class=\"link-dragging-line\"></line>\n</svg>\n" }]
3632
+ }], ctorParameters: () => [{ type: GanttUpper, decorators: [{
3633
+ type: Inject,
3634
+ args: [GANTT_UPPER_TOKEN]
3635
+ }] }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: GanttDragContainer }, { type: i0.NgZone }], propDecorators: { flatItems: [{
3636
+ type: Input
3637
+ }], lineClick: [{
3638
+ type: Output
3639
+ }], ganttLinksOverlay: [{
3640
+ type: HostBinding,
3641
+ args: ['class.gantt-links-overlay']
3642
+ }] } });
3643
+
3644
+ 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>`;
3645
+ 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>`;
3646
+ 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>`;
3647
+ 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>`;
3648
+ 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">
3649
+ <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)">
3650
+ <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform>
3651
+ </path>
3652
+ </svg>`;
3653
+ const emptyIcon = `<svg
3654
+ width="148px"
3655
+ height="134px"
3656
+ viewBox="0 0 148 134"
3657
+ version="1.1"
3658
+ xmlns="http://www.w3.org/2000/svg"
3659
+ xmlns:xlink="http://www.w3.org/1999/xlink"
3660
+ >
3661
+ <defs>
3662
+ <filter x="0.0%" y="0.0%" width="100.0%" height="100.0%" filterUnits="objectBoundingBox" id="filter-1">
3663
+ <feGaussianBlur stdDeviation="0" in="SourceGraphic"></feGaussianBlur>
3664
+ </filter>
3665
+ </defs>
3666
+ <g id="148x134" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
3667
+ <g id="编组-6" transform="translate(1.000000, 1.000000)">
3668
+ <ellipse
3669
+ id="椭圆形"
3670
+ fill="#EDEEF2"
3671
+ opacity="0.3"
3672
+ filter="url(#filter-1)"
3673
+ cx="73.0800017"
3674
+ cy="115.920003"
3675
+ rx="73.0800017"
3676
+ ry="16.8000004"
3677
+ ></ellipse>
3678
+ <g id="编组-5" transform="translate(15.120000, 0.000000)">
3679
+ <polygon
3680
+ id="矩形"
3681
+ fill="#E2E4E9"
3682
+ points="19.2789848 49.5600011 99.1200023 48.7200011 117.600003 75.9297673 117.600003 92.313049 0 92.313049 0 75.0356267"
3683
+ ></polygon>
3684
+ <path
3685
+ 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"
3686
+ id="矩形"
3687
+ fill="#F9FAFB"
3688
+ ></path>
3689
+ <path
3690
+ 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"
3691
+ id="矩形"
3692
+ fill="#E8EAEE"
3693
+ ></path>
3694
+ <text
3695
+ id="&lt;/null&gt;"
3696
+ font-family="PingFangSC-Medium, PingFang SC"
3697
+ font-size="15.1200003"
3698
+ font-weight="400"
3699
+ fill="#BCBECD"
3700
+ >
3701
+ <tspan x="33.6000008" y="32.8000004">&lt;/null&gt;</tspan>
3702
+ </text>
3703
+ <rect id="矩形" fill="#E8EAEE" x="27.5600006" y="52.0800012" width="61.4800014" height="5.04000011" rx="2.52000006"></rect>
3704
+ <rect
3705
+ id="矩形备份"
3706
+ fill="#E8EAEE"
3707
+ x="27.5600006"
3708
+ y="63.8400014"
3709
+ width="61.4800014"
3710
+ height="5.04000011"
3711
+ rx="2.52000006"
3712
+ ></rect>
3713
+ <path
3714
+ 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"
3715
+ id="矩形"
3716
+ fill="#EDEFF2"
3717
+ ></path>
3718
+ </g>
3719
+ </g>
3720
+ </g>
3721
+ </svg>`;
3722
+ const dragIcon = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="aijaction/drag--" stroke-width="1" fill-rule="evenodd"><g id="aij拖动" transform="translate(5 1)" fill-rule="nonzero"><path d="M1 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zM1 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-4 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-4 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm4 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2z" id="aij形状结合"></path></g></g></svg>`;
3723
+ const arrowLeftIcon = `<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" height="1em" width="1em" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="adinavigation/arrow-left" stroke-width="1" fill-rule="evenodd"><path d="M7.4 4.15L4.438 7.315a.6.6 0 0 1-.876-.82l3.97-4.243a.598.598 0 0 1 .93-.057l3.97 4.323a.6.6 0 1 1-.885.812L8.6 4.118v9.149c0 .404-.269.733-.6.733-.332 0-.6-.329-.6-.733V4.15z" id="adi形状结合" transform="rotate(-90 7.995 8)"></path></g></svg>`;
3724
+ const arrowRightIcon = `<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fit="" height="1em" width="1em" preserveAspectRatio="xMidYMid meet" focusable="false"><g id="adlnavigation/arrow-right" stroke-width="1" fill-rule="evenodd"><path d="M7.4 4.15L4.438 7.315a.6.6 0 0 1-.876-.82l3.97-4.243a.598.598 0 0 1 .93-.057l3.97 4.323a.6.6 0 1 1-.885.812L8.6 4.118v9.149c0 .404-.269.733-.6.733-.332 0-.6-.329-.6-.733V4.15z" id="adl形状结合" transform="rotate(90 7.995 8)"></path></g></svg>`;
3725
+ const icons = {
3726
+ 'angle-right': angleRight,
3727
+ 'angle-down': angleDown,
3728
+ 'plus-square': plusSquare,
3729
+ 'minus-square': minusSquare,
3730
+ loading: loadingIcon,
3731
+ empty: emptyIcon,
3732
+ drag: dragIcon,
3733
+ 'arrow-left': arrowLeftIcon,
3734
+ 'arrow-right': arrowRightIcon
3735
+ };
3736
+
3737
+ class GanttIconComponent {
3738
+ set iconName(name) {
3739
+ this.setSvg(name);
3740
+ }
3741
+ constructor(elementRef) {
3742
+ this.elementRef = elementRef;
3743
+ this.isIcon = true;
3372
3744
  }
3373
- mouseEnterPath(link, index) {
3374
- link.color = link.activeColor || link.defaultColor;
3375
- if (index < this.links.length - 1) {
3376
- this.links.splice(index, 1);
3377
- this.links.push(link);
3745
+ setSvg(name) {
3746
+ const iconSvg = icons[name];
3747
+ if (iconSvg) {
3748
+ this.elementRef.nativeElement.innerHTML = iconSvg;
3749
+ }
3750
+ else {
3751
+ this.elementRef.nativeElement.innerHTML = '';
3378
3752
  }
3379
3753
  }
3380
- mouseLeavePath(link) {
3381
- link.color = link.defaultColor;
3382
- }
3383
- ngOnDestroy() {
3384
- this.unsubscribe$.next();
3385
- this.unsubscribe$.complete();
3386
- }
3387
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttLinksComponent, deps: [{ token: GANTT_UPPER_TOKEN }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: GanttDragContainer }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
3388
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: GanttLinksComponent, isStandalone: true, selector: "gantt-links-overlay", inputs: { flatItems: "flatItems" }, 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 @for (link of links; track trackBy(i); let i = $index) {\n <ng-container>\n <path\n [attr.d]=\"link.path\"\n fill=\"transparent\"\n stroke-width=\"2\"\n [attr.stroke]=\"link.color\"\n pointer-events=\"none\"\n [attr.style]=\"link.type === ganttLinkTypes.sf ? 'marker-start: url(#triangle' + i + ')' : 'marker-end: url(#triangle' + i + ')'\"\n ></path>\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n [attr.d]=\"link.path\"\n (mouseenter)=\"mouseEnterPath(link, i)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n @if (showArrow) {\n <defs>\n @if (link.type === ganttLinkTypes.sf) {\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"180\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n } @else {\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"auto\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n }\n </defs>\n }\n </ng-container>\n }\n <line class=\"link-dragging-line\"></line>\n</svg>\n" }); }
3389
- }
3390
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttLinksComponent, decorators: [{
3391
- type: Component,
3392
- args: [{ selector: 'gantt-links-overlay', imports: [], template: "<svg [attr.width]=\"ganttUpper.view.width\" class=\"gantt-links-overlay-main\">\n @for (link of links; track trackBy(i); let i = $index) {\n <ng-container>\n <path\n [attr.d]=\"link.path\"\n fill=\"transparent\"\n stroke-width=\"2\"\n [attr.stroke]=\"link.color\"\n pointer-events=\"none\"\n [attr.style]=\"link.type === ganttLinkTypes.sf ? 'marker-start: url(#triangle' + i + ')' : 'marker-end: url(#triangle' + i + ')'\"\n ></path>\n <g>\n <path\n class=\"link-line\"\n (click)=\"onLineClick($event, link)\"\n [attr.d]=\"link.path\"\n (mouseenter)=\"mouseEnterPath(link, i)\"\n (mouseleave)=\"mouseLeavePath(link)\"\n stroke=\"transparent\"\n stroke-width=\"9\"\n fill=\"none\"\n cursor=\"pointer\"\n ></path>\n </g>\n @if (showArrow) {\n <defs>\n @if (link.type === ganttLinkTypes.sf) {\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"180\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n } @else {\n <marker [id]=\"'triangle' + i\" markerUnits=\"strokeWidth\" markerWidth=\"5\" markerHeight=\"4\" refX=\"5\" refY=\"2\" orient=\"auto\">\n <path [attr.fill]=\"link.color\" [attr.stroke]=\"link.color\" d=\"M 0 0 L 5 2 L 0 4 z\" />\n </marker>\n }\n </defs>\n }\n </ng-container>\n }\n <line class=\"link-dragging-line\"></line>\n</svg>\n" }]
3393
- }], ctorParameters: () => [{ type: GanttUpper, decorators: [{
3394
- type: Inject,
3395
- args: [GANTT_UPPER_TOKEN]
3396
- }] }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: GanttDragContainer }, { type: i0.NgZone }], propDecorators: { flatItems: [{
3397
- type: Input
3398
- }], lineClick: [{
3399
- type: Output
3400
- }], ganttLinksOverlay: [{
3401
- type: HostBinding,
3402
- args: ['class.gantt-links-overlay']
3403
- }] } });
3404
-
3405
- class GanttLoaderComponent {
3406
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3407
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.3", type: GanttLoaderComponent, isStandalone: true, selector: "gantt-loader", host: { classAttribute: "gantt-loader gantt-loader-overlay" }, ngImport: i0, template: `
3408
- <div class="gantt-loader-wrapper">
3409
- <div class="gantt-loader-loading">
3410
- <span class="gantt-loader-loading-spot"></span>
3411
- </div>
3412
- </div>
3413
- `, isInline: true }); }
3754
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttIconComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
3755
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.3", type: GanttIconComponent, isStandalone: true, selector: "gantt-icon", inputs: { iconName: "iconName" }, host: { properties: { "class.gantt-icon": "this.isIcon" } }, ngImport: i0, template: '', isInline: true }); }
3414
3756
  }
3415
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttLoaderComponent, decorators: [{
3757
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttIconComponent, decorators: [{
3416
3758
  type: Component,
3417
3759
  args: [{
3418
- selector: 'gantt-loader',
3419
- template: `
3420
- <div class="gantt-loader-wrapper">
3421
- <div class="gantt-loader-loading">
3422
- <span class="gantt-loader-loading-spot"></span>
3423
- </div>
3424
- </div>
3425
- `,
3426
- host: {
3427
- class: 'gantt-loader gantt-loader-overlay'
3428
- },
3429
- standalone: true
3430
- }]
3431
- }] });
3432
-
3433
- class IsGanttRangeItemPipe {
3434
- transform(value) {
3435
- return value === GanttItemType.range;
3436
- }
3437
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3438
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.3", ngImport: i0, type: IsGanttRangeItemPipe, isStandalone: true, name: "isGanttRangeItem" }); }
3439
- }
3440
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
3441
- type: Pipe,
3442
- args: [{
3443
- name: 'isGanttRangeItem',
3444
- standalone: true
3445
- }]
3446
- }] });
3447
- class IsGanttBarItemPipe {
3448
- transform(value) {
3449
- return value === GanttItemType.bar;
3450
- }
3451
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3452
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.3", ngImport: i0, type: IsGanttBarItemPipe, isStandalone: true, name: "isGanttBarItem" }); }
3453
- }
3454
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
3455
- type: Pipe,
3456
- args: [{
3457
- name: 'isGanttBarItem',
3458
- standalone: true
3459
- }]
3460
- }] });
3461
- class IsGanttCustomItemPipe {
3462
- transform(value) {
3463
- return value === GanttItemType.custom;
3464
- }
3465
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3466
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.3", ngImport: i0, type: IsGanttCustomItemPipe, isStandalone: true, name: "isGanttCustomItem" }); }
3467
- }
3468
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
3469
- type: Pipe,
3470
- args: [{
3471
- name: 'isGanttCustomItem',
3472
- standalone: true
3473
- }]
3474
- }] });
3475
- class IsGanttGroupPipe {
3476
- transform(data) {
3477
- return !!data.items;
3478
- }
3479
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttGroupPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3480
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.3", ngImport: i0, type: IsGanttGroupPipe, isStandalone: true, name: "isGanttGroup" }); }
3481
- }
3482
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: IsGanttGroupPipe, decorators: [{
3483
- type: Pipe,
3484
- args: [{
3485
- name: 'isGanttGroup',
3760
+ selector: 'gantt-icon',
3761
+ template: '',
3486
3762
  standalone: true
3487
3763
  }]
3488
- }] });
3489
-
3490
- class NgxGanttRangeComponent extends GanttItemUpper {
3491
- constructor(elementRef, ganttUpper) {
3492
- super(elementRef, ganttUpper);
3493
- this.ganttRangeClass = true;
3494
- }
3495
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: NgxGanttRangeComponent, deps: [{ token: i0.ElementRef }, { token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component }); }
3496
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: NgxGanttRangeComponent, isStandalone: true, selector: "ngx-gantt-range,gantt-range", host: { properties: { "class.gantt-range": "this.ganttRangeClass" } }, usesInheritance: true, ngImport: i0, template: "@if (item.start && item.end) {\n <div class=\"gantt-range-main\">\n @if (item.progress >= 0) {\n <div class=\"gantt-range-main-progress\" [style.width.%]=\"item.progress * 100\"></div>\n }\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}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
3497
- }
3498
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
3499
- type: Component,
3500
- args: [{ selector: 'ngx-gantt-range,gantt-range', imports: [NgTemplateOutlet], template: "@if (item.start && item.end) {\n <div class=\"gantt-range-main\">\n @if (item.progress >= 0) {\n <div class=\"gantt-range-main-progress\" [style.width.%]=\"item.progress * 100\"></div>\n }\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}\n" }]
3501
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: GanttUpper, decorators: [{
3502
- type: Inject,
3503
- args: [GANTT_UPPER_TOKEN]
3504
- }] }], propDecorators: { ganttRangeClass: [{
3764
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { isIcon: [{
3505
3765
  type: HostBinding,
3506
- args: ['class.gantt-range']
3766
+ args: ['class.gantt-icon']
3767
+ }], iconName: [{
3768
+ type: Input
3507
3769
  }] } });
3508
3770
 
3509
3771
  class GanttMainComponent {
@@ -3584,123 +3846,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
3584
3846
  type: Output
3585
3847
  }], lineClick: [{
3586
3848
  type: Output
3587
- }], ganttMainClass: [{
3588
- type: HostBinding,
3589
- args: ['class.gantt-main-container']
3590
- }] } });
3591
-
3592
- const GANTT_ABSTRACT_TOKEN = new InjectionToken('gantt-abstract-token');
3593
-
3594
- const supports = (typeof window !== 'undefined' && !!window.CSS && CSS.supports) || (() => false);
3595
- /**
3596
- * Note: we don't need to add vendor prefixes within `.scss` files since they're added automatically.
3597
- * This function is necessary when the `element.style` is updated directly through the JavaScript.
3598
- * This is not required to be used with CSS properties that don't require vendor prefixes (e.g. `opacity`).
3599
- */
3600
- function setStyleWithVendorPrefix({ element, style, value }) {
3601
- element.style[style] = value;
3602
- if (supports(`-webkit-${style}: ${value}`)) {
3603
- // Note: some browsers still require setting `-webkit` vendor prefix. E.g. Mozilla 49 has implemented
3604
- // the 3D support for `transform`, but it requires setting `-webkit-` prefix.
3605
- element.style[`-webkit-${style}`] = value;
3606
- }
3607
- }
3608
-
3609
- class GanttSyncScrollService {
3610
- constructor() {
3611
- this.ngZone = inject(NgZone);
3612
- this.scrollGroupsMap = new Map();
3613
- }
3614
- registerScrollEvent(groupName, element, direction) {
3615
- const group = this.scrollGroupsMap.get(groupName) || { elements: [], destroy$: new Subject(), direction };
3616
- group.elements.push(element);
3617
- this.scrollGroupsMap.set(groupName, group);
3618
- this.monitorScrollChange(group);
3619
- }
3620
- unregisterScrollEvent(groupName, element) {
3621
- const group = this.scrollGroupsMap.get(groupName);
3622
- if (group) {
3623
- group.elements = group.elements.filter((el) => el !== element);
3624
- if (!group.elements.length) {
3625
- this.scrollGroupsMap.delete(groupName);
3626
- }
3627
- else {
3628
- this.scrollGroupsMap.set(groupName, group);
3629
- }
3630
- this.monitorScrollChange(group);
3631
- }
3632
- }
3633
- monitorScrollChange(group) {
3634
- const { elements, destroy$, direction } = group;
3635
- destroy$.next();
3636
- destroy$.complete();
3637
- if (elements.length) {
3638
- const scrollObservers = elements.map((el) => fromEvent(el, 'scroll', passiveListenerOptions));
3639
- this.ngZone.runOutsideAngular(() => merge(...scrollObservers)
3640
- .pipe(takeUntil$1(destroy$))
3641
- .subscribe((event) => {
3642
- elements.forEach((el) => {
3643
- if (direction === 'x') {
3644
- el.scrollLeft = event.currentTarget.scrollLeft;
3645
- }
3646
- else {
3647
- el.scrollTop = event.currentTarget.scrollTop;
3648
- }
3649
- });
3650
- }));
3651
- }
3652
- }
3653
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3654
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollService }); }
3655
- }
3656
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollService, decorators: [{
3657
- type: Injectable
3658
- }], ctorParameters: () => [] });
3849
+ }], ganttMainClass: [{
3850
+ type: HostBinding,
3851
+ args: ['class.gantt-main-container']
3852
+ }] } });
3659
3853
 
3660
- class GanttSyncScrollXDirective {
3661
- constructor() {
3662
- this.syncScrollX = input();
3663
- this.elementRef = inject((ElementRef));
3664
- this.syncScrollService = inject(GanttSyncScrollService);
3665
- }
3666
- ngOnInit() {
3667
- this.syncScrollService.registerScrollEvent(this.syncScrollX(), this.elementRef.nativeElement, 'x');
3668
- }
3669
- ngOnDestroy() {
3670
- this.syncScrollService.unregisterScrollEvent(this.syncScrollX(), this.elementRef.nativeElement);
3671
- }
3672
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollXDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3673
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.3", type: GanttSyncScrollXDirective, isStandalone: true, selector: "[syncScrollX]", inputs: { syncScrollX: { classPropertyName: "syncScrollX", publicName: "syncScrollX", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
3674
- }
3675
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollXDirective, decorators: [{
3676
- type: Directive,
3677
- args: [{
3678
- selector: '[syncScrollX]',
3679
- standalone: true
3680
- }]
3681
- }], ctorParameters: () => [] });
3682
- class GanttSyncScrollYDirective {
3683
- constructor() {
3684
- this.syncScrollY = input();
3685
- this.syncScrollService = inject(GanttSyncScrollService);
3686
- this.elementRef = inject((ElementRef));
3687
- }
3688
- ngOnInit() {
3689
- this.syncScrollService.registerScrollEvent(this.syncScrollY(), this.elementRef.nativeElement, 'y');
3690
- }
3691
- ngOnDestroy() {
3692
- this.syncScrollService.unregisterScrollEvent(this.syncScrollY(), this.elementRef.nativeElement);
3854
+ const GANTT_ABSTRACT_TOKEN = new InjectionToken('gantt-abstract-token');
3855
+
3856
+ const supports = (typeof window !== 'undefined' && !!window.CSS && CSS.supports) || (() => false);
3857
+ /**
3858
+ * Note: we don't need to add vendor prefixes within `.scss` files since they're added automatically.
3859
+ * This function is necessary when the `element.style` is updated directly through the JavaScript.
3860
+ * This is not required to be used with CSS properties that don't require vendor prefixes (e.g. `opacity`).
3861
+ */
3862
+ function setStyleWithVendorPrefix({ element, style, value }) {
3863
+ element.style[style] = value;
3864
+ if (supports(`-webkit-${style}: ${value}`)) {
3865
+ // Note: some browsers still require setting `-webkit` vendor prefix. E.g. Mozilla 49 has implemented
3866
+ // the 3D support for `transform`, but it requires setting `-webkit-` prefix.
3867
+ element.style[`-webkit-${style}`] = value;
3693
3868
  }
3694
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollYDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3695
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.3", type: GanttSyncScrollYDirective, isStandalone: true, selector: "[syncScrollY]", inputs: { syncScrollY: { classPropertyName: "syncScrollY", publicName: "syncScrollY", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
3696
3869
  }
3697
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttSyncScrollYDirective, decorators: [{
3698
- type: Directive,
3699
- args: [{
3700
- selector: '[syncScrollY]',
3701
- standalone: true
3702
- }]
3703
- }], ctorParameters: () => [] });
3704
3870
 
3705
3871
  const defaultColumnWidth = 100;
3706
3872
  const minColumnWidth = 80;
@@ -4162,148 +4328,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
4162
4328
  args: [(CdkDrag)]
4163
4329
  }] } });
4164
4330
 
4165
- class NgxGanttToolbarComponent {
4166
- get top() {
4167
- return this.ganttUpper.styles.headerHeight + 16 + 'px';
4168
- }
4169
- constructor(ganttUpper) {
4170
- this.ganttUpper = ganttUpper;
4171
- this.ganttItemClass = true;
4172
- this.views = inject(GanttConfigService).getViewsLocale();
4173
- }
4174
- selectView(view) {
4175
- this.ganttUpper.changeView(view);
4176
- }
4177
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: NgxGanttToolbarComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component }); }
4178
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.3", type: NgxGanttToolbarComponent, isStandalone: true, selector: "ngx-gantt-toolbar,gantt-toolbar", inputs: { template: "template" }, host: { properties: { "class.gantt-toolbar": "this.ganttItemClass", "style.top": "this.top" } }, ngImport: i0, template: "<div class=\"toolbar-container\">\n @if (!template) {\n @if (this.ganttUpper.toolbarOptions?.viewTypes?.length) {\n <div class=\"toolbar-views\">\n @for (viewType of this.ganttUpper.toolbarOptions?.viewTypes; track viewType) {\n @if (views[viewType]) {\n <div class=\"toolbar-view\" [class.active]=\"viewType === this.ganttUpper.viewType\" (click)=\"selectView(viewType)\">\n {{ views[viewType].label }}\n </div>\n }\n }\n </div>\n }\n }\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
4179
- }
4180
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
4181
- type: Component,
4182
- args: [{ selector: 'ngx-gantt-toolbar,gantt-toolbar', imports: [NgTemplateOutlet], template: "<div class=\"toolbar-container\">\n @if (!template) {\n @if (this.ganttUpper.toolbarOptions?.viewTypes?.length) {\n <div class=\"toolbar-views\">\n @for (viewType of this.ganttUpper.toolbarOptions?.viewTypes; track viewType) {\n @if (views[viewType]) {\n <div class=\"toolbar-view\" [class.active]=\"viewType === this.ganttUpper.viewType\" (click)=\"selectView(viewType)\">\n {{ views[viewType].label }}\n </div>\n }\n }\n </div>\n }\n }\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\n" }]
4183
- }], ctorParameters: () => [{ type: GanttUpper, decorators: [{
4184
- type: Inject,
4185
- args: [GANTT_UPPER_TOKEN]
4186
- }] }], propDecorators: { template: [{
4187
- type: Input
4188
- }], ganttItemClass: [{
4189
- type: HostBinding,
4190
- args: ['class.gantt-toolbar']
4191
- }], top: [{
4192
- type: HostBinding,
4193
- args: ['style.top']
4194
- }] } });
4195
-
4196
- class GanttScrollbarComponent {
4197
- constructor(ganttUpper) {
4198
- this.ganttUpper = ganttUpper;
4199
- this.hasFooter = input(false);
4200
- this.tableWidth = input();
4201
- this.ganttRoot = input();
4202
- this.tableScrollWidth = input(0);
4203
- }
4204
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttScrollbarComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component }); }
4205
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.3", type: GanttScrollbarComponent, isStandalone: true, selector: "gantt-scrollbar", inputs: { hasFooter: { classPropertyName: "hasFooter", publicName: "hasFooter", isSignal: true, isRequired: false, transformFunction: null }, tableWidth: { classPropertyName: "tableWidth", publicName: "tableWidth", isSignal: true, isRequired: false, transformFunction: null }, ganttRoot: { classPropertyName: "ganttRoot", publicName: "ganttRoot", isSignal: true, isRequired: false, transformFunction: null }, tableScrollWidth: { classPropertyName: "tableScrollWidth", publicName: "tableScrollWidth", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div\n class=\"gantt-scrollbar\"\n [ngClass]=\"{ 'gantt-scrollbar-bg': hasFooter() }\"\n [style.height.px]=\"ganttRoot()?.horizontalScrollbarHeight + 1\"\n [style.right.px]=\"ganttRoot()?.verticalScrollbarWidth\"\n>\n <div\n class=\"gantt-table-scrollbar\"\n syncScrollX=\"ganttTableXScroll\"\n [class.with-scrollbar]=\"ganttRoot()?.horizontalScrollbarHeight\"\n [style.width.px]=\"tableWidth()\"\n >\n <div class=\"h-100\" [style.width.px]=\"tableScrollWidth() - 1\"></div>\n </div>\n <div class=\"gantt-main-scrollbar\" syncScrollX=\"ganttMainXScroll\">\n <div class=\"h-100\" [style.width.px]=\"ganttRoot()['view']?.width\"></div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: GanttSyncScrollXDirective, selector: "[syncScrollX]", inputs: ["syncScrollX"] }] }); }
4206
- }
4207
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttScrollbarComponent, decorators: [{
4208
- type: Component,
4209
- args: [{ selector: 'gantt-scrollbar', imports: [NgClass, GanttSyncScrollXDirective], template: "<div\n class=\"gantt-scrollbar\"\n [ngClass]=\"{ 'gantt-scrollbar-bg': hasFooter() }\"\n [style.height.px]=\"ganttRoot()?.horizontalScrollbarHeight + 1\"\n [style.right.px]=\"ganttRoot()?.verticalScrollbarWidth\"\n>\n <div\n class=\"gantt-table-scrollbar\"\n syncScrollX=\"ganttTableXScroll\"\n [class.with-scrollbar]=\"ganttRoot()?.horizontalScrollbarHeight\"\n [style.width.px]=\"tableWidth()\"\n >\n <div class=\"h-100\" [style.width.px]=\"tableScrollWidth() - 1\"></div>\n </div>\n <div class=\"gantt-main-scrollbar\" syncScrollX=\"ganttMainXScroll\">\n <div class=\"h-100\" [style.width.px]=\"ganttRoot()['view']?.width\"></div>\n </div>\n</div>\n" }]
4210
- }], ctorParameters: () => [{ type: GanttUpper, decorators: [{
4211
- type: Inject,
4212
- args: [GANTT_UPPER_TOKEN]
4213
- }] }] });
4214
-
4215
- class GanttPrintService {
4216
- constructor() { }
4217
- setInlineStyles(targetElem) {
4218
- const svgElements = Array.from(targetElem.getElementsByTagName('svg'));
4219
- for (const svgElement of svgElements) {
4220
- this.recursElementChildren(svgElement);
4221
- }
4222
- }
4223
- recursElementChildren(node) {
4224
- const transformProperties = [
4225
- 'fill',
4226
- 'color',
4227
- 'font-size',
4228
- 'stroke',
4229
- 'font',
4230
- 'text-anchor',
4231
- 'stroke-dasharray',
4232
- 'shape-rendering',
4233
- 'stroke-width'
4234
- ];
4235
- if (!node.style) {
4236
- return;
4237
- }
4238
- const styles = getComputedStyle(node);
4239
- for (const transformProperty of transformProperties) {
4240
- node.style[transformProperty] = styles[transformProperty];
4241
- }
4242
- for (const child of Array.from(node.childNodes)) {
4243
- this.recursElementChildren(child);
4244
- }
4245
- }
4246
- register(root) {
4247
- this.root = root.nativeElement;
4248
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
4249
- }
4250
- async print(name = 'download', ignoreElementClass) {
4251
- const root = this.root;
4252
- const mainContainer = this.mainContainer;
4253
- // set print width
4254
- const printWidth = root.offsetWidth;
4255
- // set print height
4256
- const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
4257
- const html2canvas = (await import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')).default;
4258
- html2canvas(root, {
4259
- logging: false,
4260
- allowTaint: true,
4261
- useCORS: true,
4262
- width: printWidth,
4263
- height: printHeight,
4264
- ignoreElements: (element) => {
4265
- if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
4266
- return true;
4267
- }
4268
- if (element.classList.contains('gantt-calendar-today-overlay')) {
4269
- return true;
4270
- }
4271
- },
4272
- onclone: (cloneDocument) => {
4273
- const ganttClass = root.className;
4274
- const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
4275
- const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
4276
- const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-grid-main');
4277
- const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
4278
- // change targetDom width
4279
- cloneGanttDom.style.width = `${printWidth}px`;
4280
- cloneGanttDom.style.height = `${printHeight}px`;
4281
- cloneGanttDom.style.overflow = `unset`;
4282
- cloneGanttContainerDom.style.backgroundColor = '#fff';
4283
- cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
4284
- cloneCalendarOverlay.setAttribute('style', `background: transparent`);
4285
- if (cloneLinksOverlay) {
4286
- cloneLinksOverlay.setAttribute('height', `${printHeight}`);
4287
- cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
4288
- }
4289
- // setInlineStyles for svg
4290
- this.setInlineStyles(cloneGanttDom);
4291
- }
4292
- }).then((canvas) => {
4293
- const link = document.createElement('a');
4294
- const dataUrl = canvas.toDataURL('image/png');
4295
- link.download = `${name}.png`;
4296
- link.href = dataUrl;
4297
- link.click();
4298
- });
4299
- }
4300
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4301
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttPrintService }); }
4302
- }
4303
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: GanttPrintService, decorators: [{
4304
- type: Injectable
4305
- }], ctorParameters: () => [] });
4306
-
4307
4331
  class NgxGanttRootComponent {
4308
4332
  get view() {
4309
4333
  return this.ganttUpper.view;
@@ -4596,11 +4620,9 @@ class NgxGanttComponent extends GanttUpper {
4596
4620
  this._loading = false;
4597
4621
  this.rangeStart = 0;
4598
4622
  this.rangeEnd = 0;
4599
- this.computeAllRefs = false;
4600
4623
  }
4601
4624
  ngOnInit() {
4602
4625
  super.ngOnInit();
4603
- this.buildFlatItems();
4604
4626
  // Note: the zone may be nooped through `BootstrapOptions` when bootstrapping the root module. This means
4605
4627
  // the `onStable` will never emit any value.
4606
4628
  const onStable$ = this.ngZone.isStable ? from(Promise.resolve()) : this.ngZone.onStable.pipe(take(1));
@@ -4616,27 +4638,35 @@ class NgxGanttComponent extends GanttUpper {
4616
4638
  });
4617
4639
  });
4618
4640
  });
4619
- this.view.start$.pipe(skip(1), takeUntil(this.unsubscribe$)).subscribe(() => {
4620
- this.computeTempDataRefs();
4621
- });
4641
+ // 如果虚拟滚动未启用,初始化时需要手动填充 viewportItems
4622
4642
  if (!this.virtualScrollEnabled) {
4623
4643
  this.viewportItems = this.flatItems.slice(this.rangeStart, this.rangeEnd);
4624
- this.computeTempDataRefs();
4644
+ this.computeRefs();
4625
4645
  }
4626
4646
  }
4627
- ngOnChanges(changes) {
4628
- super.ngOnChanges(changes);
4629
- if (!this.firstChange) {
4630
- if (changes.viewType && changes.viewType.currentValue) {
4631
- this.viewportItems = this.flatItems.slice(this.rangeStart, this.rangeEnd);
4632
- this.computeTempDataRefs();
4633
- }
4634
- if (changes.originItems || changes.originGroups) {
4635
- this.buildFlatItems();
4636
- this.viewportItems = this.flatItems.slice(this.rangeStart, this.rangeEnd);
4637
- this.computeTempDataRefs();
4647
+ computeRefs() {
4648
+ const tempItemData = [];
4649
+ this.viewportItems.forEach((data) => {
4650
+ if (!data.hasOwnProperty('items')) {
4651
+ const item = data;
4652
+ if (item.links) {
4653
+ item.links.forEach((link) => {
4654
+ if (this.flatItemsMap[link.link]) {
4655
+ tempItemData.push(this.flatItemsMap[link.link]);
4656
+ }
4657
+ });
4658
+ }
4659
+ tempItemData.push(data);
4638
4660
  }
4639
- }
4661
+ });
4662
+ this.computeItemsRefs(...uniqBy(tempItemData, 'id'));
4663
+ this.flatItems = [...this.flatItems];
4664
+ this.viewportItems = [...this.viewportItems];
4665
+ }
4666
+ setupItems() {
4667
+ super.setupItems();
4668
+ this.buildFlatItems();
4669
+ this.viewportItems = this.flatItems.slice(this.rangeStart, this.rangeEnd);
4640
4670
  }
4641
4671
  ngAfterViewInit() {
4642
4672
  if (this.virtualScrollEnabled) {
@@ -4647,7 +4677,7 @@ class NgxGanttComponent extends GanttUpper {
4647
4677
  this.rangeEnd = range.end;
4648
4678
  this.viewportItems = this.flatItems.slice(range.start, range.end);
4649
4679
  this.appendDraggingItemToViewportItems();
4650
- this.computeTempDataRefs();
4680
+ this.computeRefs();
4651
4681
  });
4652
4682
  }
4653
4683
  this.initScrollContainerObserver();
@@ -4690,25 +4720,6 @@ class NgxGanttComponent extends GanttUpper {
4690
4720
  this.buildFlatItems();
4691
4721
  this.viewportItems = this.flatItems.slice(this.rangeStart, this.rangeEnd);
4692
4722
  }
4693
- computeTempDataRefs() {
4694
- const tempItemData = [];
4695
- this.viewportItems.forEach((data) => {
4696
- if (!data.hasOwnProperty('items')) {
4697
- const item = data;
4698
- if (item.links) {
4699
- item.links.forEach((link) => {
4700
- if (this.flatItemsMap[link.link]) {
4701
- tempItemData.push(this.flatItemsMap[link.link]);
4702
- }
4703
- });
4704
- }
4705
- tempItemData.push(data);
4706
- }
4707
- });
4708
- this.computeItemsRefs(...uniqBy(tempItemData, 'id'));
4709
- this.flatItems = [...this.flatItems];
4710
- this.viewportItems = [...this.viewportItems];
4711
- }
4712
4723
  appendDraggingItemToViewportItems() {
4713
4724
  if (this.draggingItem) {
4714
4725
  let flatItem = this.viewportItems.find((item) => {
@@ -4789,23 +4800,18 @@ class NgxGanttComponent extends GanttUpper {
4789
4800
  count: this.flatItems.length
4790
4801
  });
4791
4802
  }
4792
- changeView(type) {
4793
- super.changeView(type);
4794
- this.viewportItems = this.flatItems.slice(this.rangeStart, this.rangeEnd);
4795
- this.computeTempDataRefs();
4796
- }
4797
4803
  expandGroups(expanded) {
4798
4804
  this.groups.forEach((group) => {
4799
4805
  group.setExpand(expanded);
4800
4806
  });
4801
4807
  this.afterExpand();
4802
- this.expandChange.next(null);
4808
+ this.expandChange.emit(this.groups);
4803
4809
  this.cdr.detectChanges();
4804
4810
  }
4805
4811
  expandGroup(group) {
4806
4812
  group.setExpand(!group.expanded);
4807
4813
  this.afterExpand();
4808
- this.expandChange.emit();
4814
+ this.expandChange.emit(group);
4809
4815
  this.cdr.detectChanges();
4810
4816
  }
4811
4817
  itemDragStarted(event) {
@@ -4847,7 +4853,7 @@ class NgxGanttComponent extends GanttUpper {
4847
4853
  provide: GANTT_ABSTRACT_TOKEN,
4848
4854
  useExisting: forwardRef(() => NgxGanttComponent)
4849
4855
  }
4850
- ], queries: [{ propertyName: "table", first: true, predicate: NgxGanttTableComponent, descendants: true }, { propertyName: "tableEmptyTemplate", first: true, predicate: ["tableEmpty"], descendants: true, static: true }, { propertyName: "footerTemplate", first: true, predicate: ["footer"], descendants: true, static: true }, { propertyName: "columns", predicate: NgxGanttTableColumnComponent, descendants: true }], viewQueries: [{ propertyName: "ganttRoot", first: true, predicate: ["ganttRoot"], descendants: true }, { propertyName: "virtualScroll", first: true, predicate: CdkVirtualScrollViewport, descendants: true }, { propertyName: "ganttTableBody", first: true, predicate: ["ganttTableBody"], descendants: true, static: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ngx-gantt-root #ganttRoot>\n <div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header\n syncScrollX=\"ganttMainXScroll\"\n [style.padding-right.px]=\"ganttRoot.verticalScrollbarWidth\"\n ></gantt-calendar-header>\n </div>\n </div>\n @if (loading) {\n <gantt-loader></gantt-loader>\n }\n\n <cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [ngClass]=\"{\n 'gantt-normal-viewport': !virtualScrollEnabled,\n 'gantt-scroll-container': virtualScrollEnabled,\n 'with-footer': table?.tableFooterTemplate || footerTemplate\n }\"\n [style.top.px]=\"styles.headerHeight\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n (scrolledIndexChange)=\"scrolledIndexChange($event)\"\n >\n <ng-container *cdkVirtualFor=\"let item of flatItems; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth + 1\" [style.padding-bottom.px]=\"ganttRoot.horizontalScrollbarHeight\">\n <div class=\"gantt-side-container\" syncScrollX=\"ganttTableXScroll\" syncScrollY=\"ganttMainYScroll\">\n <div class=\"gantt-table\">\n <gantt-table-body\n #ganttTableBody\n [flatItems]=\"flatItems\"\n [viewportItems]=\"viewportItems\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"table.tableEmptyTemplate || tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n [draggable]=\"table.draggable\"\n [dropEnterPredicate]=\"table.dropEnterPredicate\"\n (dragDropped)=\"table.dragDropped.emit($event)\"\n (dragStarted)=\"itemDragStarted($event)\"\n (dragEnded)=\"itemDragEnded($event)\"\n (itemClick)=\"selectItem($event)\"\n >\n </gantt-table-body>\n </div>\n </div>\n </div>\n <div class=\"gantt-container\">\n <gantt-calendar-grid\n syncScrollX=\"ganttMainXScroll\"\n [style.padding-right.px]=\"ganttRoot.verticalScrollbarWidth\"\n [style.padding-bottom.px]=\"ganttRoot.horizontalScrollbarHeight\"\n ></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n syncScrollX=\"ganttMainXScroll\"\n syncScrollY=\"ganttMainYScroll\"\n [ganttRoot]=\"ganttRoot\"\n [flatItems]=\"flatItems\"\n [viewportItems]=\"viewportItems\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n [baselineTemplate]=\"baselineTemplate\"\n [quickTimeFocus]=\"quickTimeFocus\"\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 + 1\"></gantt-drag-backdrop>\n\n <gantt-scrollbar\n [ganttRoot]=\"ganttRoot\"\n [hasFooter]=\"!!table?.tableFooterTemplate\"\n [tableWidth]=\"tableHeader.tableWidth\"\n [tableScrollWidth]=\"tableScrollWidth()\"\n ></gantt-scrollbar>\n\n @if (table?.tableFooterTemplate || footerTemplate) {\n <div\n class=\"gantt-footer\"\n cdkScrollable\n [style.right.px]=\"ganttRoot.verticalScrollbarWidth\"\n [style.bottom.px]=\"ganttRoot.horizontalScrollbarHeight\"\n >\n @if (table?.tableFooterTemplate) {\n <div class=\"gantt-table-footer\" syncScrollX=\"ganttTableXScroll\" [style.width.px]=\"tableHeader.tableWidth + 1\">\n <ng-template [ngTemplateOutlet]=\"table?.tableFooterTemplate\" [ngTemplateOutletContext]=\"{ columns: columns }\"> </ng-template>\n </div>\n }\n @if (footerTemplate) {\n <div class=\"gantt-container-footer\" syncScrollX=\"ganttMainXScroll\">\n <ng-template [ngTemplateOutlet]=\"footerTemplate\"> </ng-template>\n </div>\n }\n </div>\n }\n</ngx-gantt-root>\n", dependencies: [{ kind: "component", type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }, { kind: "component", type: GanttTableHeaderComponent, selector: "gantt-table-header", inputs: ["columns"] }, { kind: "component", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header" }, { kind: "component", type: GanttLoaderComponent, selector: "gantt-loader" }, { kind: "component", type: CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: ["viewportItems", "flatItems", "columns", "groupTemplate", "emptyTemplate", "rowBeforeTemplate", "rowAfterTemplate", "draggable", "dropEnterPredicate"], outputs: ["dragDropped", "dragStarted", "dragEnded", "itemClick"] }, { kind: "component", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid" }, { kind: "component", type: GanttMainComponent, selector: "gantt-main", inputs: ["viewportItems", "flatItems", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate", "baselineTemplate", "ganttRoot", "quickTimeFocus"], outputs: ["barClick", "lineClick"] }, { kind: "component", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }, { kind: "component", type: GanttScrollbarComponent, selector: "gantt-scrollbar", inputs: ["hasFooter", "tableWidth", "ganttRoot", "tableScrollWidth"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: GanttSyncScrollXDirective, selector: "[syncScrollX]", inputs: ["syncScrollX"] }, { kind: "directive", type: GanttSyncScrollYDirective, selector: "[syncScrollY]", inputs: ["syncScrollY"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4856
+ ], queries: [{ propertyName: "table", first: true, predicate: NgxGanttTableComponent, descendants: true }, { propertyName: "tableEmptyTemplate", first: true, predicate: ["tableEmpty"], descendants: true, static: true }, { propertyName: "footerTemplate", first: true, predicate: ["footer"], descendants: true, static: true }, { propertyName: "columns", predicate: NgxGanttTableColumnComponent, descendants: true }], viewQueries: [{ propertyName: "ganttRoot", first: true, predicate: ["ganttRoot"], descendants: true }, { propertyName: "virtualScroll", first: true, predicate: CdkVirtualScrollViewport, descendants: true }, { propertyName: "ganttTableBody", first: true, predicate: ["ganttTableBody"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ngx-gantt-root #ganttRoot>\n <div class=\"gantt-header\">\n <gantt-table-header #tableHeader [columns]=\"columns\"></gantt-table-header>\n <div class=\"gantt-container-header\">\n <gantt-calendar-header\n syncScrollX=\"ganttMainXScroll\"\n [style.padding-right.px]=\"ganttRoot.verticalScrollbarWidth\"\n ></gantt-calendar-header>\n </div>\n </div>\n @if (loading) {\n <gantt-loader></gantt-loader>\n }\n\n <cdk-virtual-scroll-viewport\n class=\"gantt-virtual-scroll-viewport\"\n [ngClass]=\"{\n 'gantt-normal-viewport': !virtualScrollEnabled,\n 'gantt-scroll-container': virtualScrollEnabled,\n 'with-footer': table?.tableFooterTemplate || footerTemplate\n }\"\n [style.top.px]=\"styles.headerHeight\"\n [itemSize]=\"styles.lineHeight\"\n [minBufferPx]=\"styles.lineHeight * 10\"\n [maxBufferPx]=\"styles.lineHeight * 20\"\n (scrolledIndexChange)=\"scrolledIndexChange($event)\"\n >\n <ng-container *cdkVirtualFor=\"let item of flatItems; trackBy: trackBy\"></ng-container>\n <div class=\"gantt-side\" [style.width.px]=\"tableHeader.tableWidth + 1\" [style.padding-bottom.px]=\"ganttRoot.horizontalScrollbarHeight\">\n <div class=\"gantt-side-container\" syncScrollX=\"ganttTableXScroll\" syncScrollY=\"ganttMainYScroll\">\n <div class=\"gantt-table\">\n <gantt-table-body\n #ganttTableBody\n [flatItems]=\"flatItems\"\n [viewportItems]=\"viewportItems\"\n [columns]=\"columns\"\n [groupTemplate]=\"groupTemplate\"\n [emptyTemplate]=\"table.tableEmptyTemplate || tableEmptyTemplate\"\n [rowBeforeTemplate]=\"table?.rowBeforeTemplate\"\n [rowAfterTemplate]=\"table?.rowAfterTemplate\"\n [draggable]=\"table.draggable\"\n [dropEnterPredicate]=\"table.dropEnterPredicate\"\n (dragDropped)=\"table.dragDropped.emit($event)\"\n (dragStarted)=\"itemDragStarted($event)\"\n (dragEnded)=\"itemDragEnded($event)\"\n (itemClick)=\"selectItem($event)\"\n >\n </gantt-table-body>\n </div>\n </div>\n </div>\n <div class=\"gantt-container\">\n <gantt-calendar-grid\n syncScrollX=\"ganttMainXScroll\"\n [style.padding-right.px]=\"ganttRoot.verticalScrollbarWidth\"\n [style.padding-bottom.px]=\"ganttRoot.horizontalScrollbarHeight\"\n ></gantt-calendar-grid>\n <div class=\"gantt-main\">\n <gantt-main\n syncScrollX=\"ganttMainXScroll\"\n syncScrollY=\"ganttMainYScroll\"\n [ganttRoot]=\"ganttRoot\"\n [flatItems]=\"flatItems\"\n [viewportItems]=\"viewportItems\"\n [groupHeaderTemplate]=\"groupHeaderTemplate\"\n [itemTemplate]=\"itemTemplate\"\n [barTemplate]=\"barTemplate\"\n [rangeTemplate]=\"rangeTemplate\"\n [baselineTemplate]=\"baselineTemplate\"\n [quickTimeFocus]=\"quickTimeFocus\"\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 + 1\"></gantt-drag-backdrop>\n\n <gantt-scrollbar\n [ganttRoot]=\"ganttRoot\"\n [hasFooter]=\"!!table?.tableFooterTemplate\"\n [tableWidth]=\"tableHeader.tableWidth\"\n [tableScrollWidth]=\"tableScrollWidth()\"\n ></gantt-scrollbar>\n\n @if (table?.tableFooterTemplate || footerTemplate) {\n <div\n class=\"gantt-footer\"\n cdkScrollable\n [style.right.px]=\"ganttRoot.verticalScrollbarWidth\"\n [style.bottom.px]=\"ganttRoot.horizontalScrollbarHeight\"\n >\n @if (table?.tableFooterTemplate) {\n <div class=\"gantt-table-footer\" syncScrollX=\"ganttTableXScroll\" [style.width.px]=\"tableHeader.tableWidth + 1\">\n <ng-template [ngTemplateOutlet]=\"table?.tableFooterTemplate\" [ngTemplateOutletContext]=\"{ columns: columns }\"> </ng-template>\n </div>\n }\n @if (footerTemplate) {\n <div class=\"gantt-container-footer\" syncScrollX=\"ganttMainXScroll\">\n <ng-template [ngTemplateOutlet]=\"footerTemplate\"> </ng-template>\n </div>\n }\n </div>\n }\n</ngx-gantt-root>\n", dependencies: [{ kind: "component", type: NgxGanttRootComponent, selector: "ngx-gantt-root", inputs: ["sideWidth"] }, { kind: "component", type: GanttTableHeaderComponent, selector: "gantt-table-header", inputs: ["columns"] }, { kind: "component", type: GanttCalendarHeaderComponent, selector: "gantt-calendar-header" }, { kind: "component", type: GanttLoaderComponent, selector: "gantt-loader" }, { kind: "component", type: CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: GanttTableBodyComponent, selector: "gantt-table-body", inputs: ["viewportItems", "flatItems", "columns", "groupTemplate", "emptyTemplate", "rowBeforeTemplate", "rowAfterTemplate", "draggable", "dropEnterPredicate"], outputs: ["dragDropped", "dragStarted", "dragEnded", "itemClick"] }, { kind: "component", type: GanttCalendarGridComponent, selector: "gantt-calendar-grid" }, { kind: "component", type: GanttMainComponent, selector: "gantt-main", inputs: ["viewportItems", "flatItems", "groupHeaderTemplate", "itemTemplate", "barTemplate", "rangeTemplate", "baselineTemplate", "ganttRoot", "quickTimeFocus"], outputs: ["barClick", "lineClick"] }, { kind: "component", type: GanttDragBackdropComponent, selector: "gantt-drag-backdrop" }, { kind: "component", type: GanttScrollbarComponent, selector: "gantt-scrollbar", inputs: ["hasFooter", "tableWidth", "ganttRoot", "tableScrollWidth"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: GanttSyncScrollXDirective, selector: "[syncScrollX]", inputs: ["syncScrollX"] }, { kind: "directive", type: GanttSyncScrollYDirective, selector: "[syncScrollY]", inputs: ["syncScrollY"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4851
4857
  }
4852
4858
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImport: i0, type: NgxGanttComponent, decorators: [{
4853
4859
  type: Component,
@@ -5042,5 +5048,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.3", ngImpor
5042
5048
  * Generated bundle index. Do not edit.
5043
5049
  */
5044
5050
 
5045
- export { GANTT_GLOBAL_CONFIG, GANTT_I18N_LOCALE_TOKEN, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttBaselineItemInternal, GanttCalendarGridComponent, GanttCalendarHeaderComponent, GanttConfigService, GanttDate, GanttDatePoint, GanttDragBackdropComponent, GanttDragEvent, GanttGroupInternal, GanttI18nLocale, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLinkLineType, GanttLinkType, GanttLoadOnScrollEvent, GanttLoaderComponent, GanttPrintService, GanttScrollbarComponent, GanttSelectedEvent, GanttTableDragDroppedEvent, GanttTableDragEndedEvent, GanttTableDragEnterPredicateContext, GanttTableDragStartedEvent, GanttTableEvent, GanttTableItemClickEvent, GanttUpper, GanttView, GanttViewType, GanttVirtualScrolledIndexChangeEvent, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttGroupPipe, IsGanttRangeItemPipe, LinkColors, NgxGanttBarComponent, NgxGanttBaselineComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, NgxGanttToolbarComponent, deDeLocale, defaultConfig, enUsLocale, getDefaultTimeZone, jaJpLocale, primaryDatePointTop, registerView, ruRuLocale, secondaryDatePointTop, setDefaultTimeZone, zhHans as zhHansLocale, zhHant as zhHantLocale };
5051
+ export { GANTT_GLOBAL_CONFIG, GANTT_I18N_LOCALE_TOKEN, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttBaselineItemInternal, GanttCalendarGridComponent, GanttCalendarHeaderComponent, GanttConfigService, GanttDate, GanttDatePoint, GanttDragBackdropComponent, GanttDragEvent, GanttGroupInternal, GanttI18nLocale, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLinkLineType, GanttLinkType, GanttLoadOnScrollEvent, GanttLoaderComponent, GanttPrintService, GanttScrollbarComponent, GanttSelectedEvent, GanttTableDragDroppedEvent, GanttTableDragEndedEvent, GanttTableDragEnterPredicateContext, GanttTableDragStartedEvent, GanttTableEvent, GanttTableItemClickEvent, GanttUpper, GanttView, GanttViewType, GanttVirtualScrolledIndexChangeEvent, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttGroupPipe, IsGanttRangeItemPipe, LinkColors, NgxGanttBarComponent, NgxGanttBaselineComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, NgxGanttToolbarComponent, deDeLocale, defaultConfig, enUsLocale, getDefaultTimeZone, jaJpLocale, primaryDatePointTop, registerView, ruRuLocale, secondaryDatePointTop, setDefaultTimeZone, zhHansLocale, zhHantLocale };
5046
5052
  //# sourceMappingURL=worktile-gantt.mjs.map