@worktile/gantt 20.0.0 → 20.0.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,16 +1,16 @@
1
- import { DragDrop, CdkDrag, CdkDropList, CdkDragHandle, DragDropModule } from '@angular/cdk/drag-drop';
2
- import { CdkScrollable, ViewportRuler, CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, ScrollingModule } from '@angular/cdk/scrolling';
3
- import { isPlatformServer, NgTemplateOutlet, NgStyle, NgClass, CommonModule } from '@angular/common';
4
- import * as i0 from '@angular/core';
5
- import { inject, NgZone, PLATFORM_ID, signal, Injectable, InjectionToken, ElementRef, ChangeDetectorRef, EventEmitter, HostBinding, ContentChild, Output, Input, Directive, effect, ViewChildren, ViewChild, Component, Inject, Pipe, input, DOCUMENT, HostListener, forwardRef, ContentChildren, ChangeDetectionStrategy, NgModule } from '@angular/core';
6
- import { BehaviorSubject, Subject, fromEvent, Observable, merge, EMPTY, from, interval, animationFrameScheduler, take as take$1, takeUntil as takeUntil$1, combineLatest, startWith as startWith$1, auditTime as auditTime$1, filter } from 'rxjs';
7
- import { takeUntil, map, pairwise, auditTime, take, skip, startWith, switchMap, debounceTime, finalize } from 'rxjs/operators';
8
- 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';
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, differenceInDays, differenceInHours, differenceInMinutes, eachWeekOfInterval, eachDayOfInterval, eachHourOfInterval, differenceInCalendarQuarters, eachMonthOfInterval, eachYearOfInterval, differenceInCalendarYears } from 'date-fns';
9
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';
10
3
  import { TZDate } from '@date-fns/tz';
11
- import { de, ru } from 'date-fns/locale';
12
- import { SelectionModel } from '@angular/cdk/collections';
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
+ import { isPlatformServer, NgTemplateOutlet, NgStyle, NgClass, CommonModule } from '@angular/common';
6
+ import * as i0 from '@angular/core';
7
+ import { InjectionToken, inject, Injectable, ElementRef, ChangeDetectorRef, NgZone, EventEmitter, HostBinding, ContentChild, Output, Input, Directive, PLATFORM_ID, signal, effect, ViewChildren, ViewChild, Component, input, Pipe, Inject, DOCUMENT, HostListener, forwardRef, ContentChildren, ChangeDetectionStrategy, NgModule } from '@angular/core';
8
+ import { take, takeUntil, skip, map, pairwise, auditTime, startWith, switchMap, debounceTime, finalize } from 'rxjs/operators';
13
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 { DragDrop, CdkDrag, CdkDropList, CdkDragHandle, DragDropModule } from '@angular/cdk/drag-drop';
13
+ import { CdkScrollable, ViewportRuler, CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, ScrollingModule } from '@angular/cdk/scrolling';
14
14
  import { __decorate, __param } from 'tslib';
15
15
 
16
16
  class GanttDatePoint {
@@ -376,6 +376,174 @@ class GanttBaselineItemInternal {
376
376
  }
377
377
  }
378
378
 
379
+ var GanttI18nLocale;
380
+ (function (GanttI18nLocale) {
381
+ GanttI18nLocale["zhHans"] = "zh-hans";
382
+ GanttI18nLocale["zhHant"] = "zh-hant";
383
+ GanttI18nLocale["enUs"] = "en-us";
384
+ GanttI18nLocale["deDe"] = "de-de";
385
+ GanttI18nLocale["jaJp"] = "ja-jp";
386
+ GanttI18nLocale["ruRu"] = "ru-ru";
387
+ })(GanttI18nLocale || (GanttI18nLocale = {}));
388
+ const GANTT_I18N_LOCALE_TOKEN = new InjectionToken('gantt-i18n-locale');
389
+
390
+ var zhHansLocale = {
391
+ id: GanttI18nLocale.zhHans,
392
+ views: {
393
+ [GanttViewType.hour]: {
394
+ label: '小时',
395
+ dateFormats: {
396
+ primary: 'M月d日',
397
+ secondary: 'HH:mm'
398
+ }
399
+ },
400
+ [GanttViewType.day]: {
401
+ label: '天',
402
+ dateFormats: {
403
+ primary: 'yyyy年MM月',
404
+ secondary: 'd'
405
+ }
406
+ },
407
+ [GanttViewType.week]: {
408
+ label: '周',
409
+ dateFormats: {
410
+ primary: 'yyyy年',
411
+ secondary: '第w周'
412
+ }
413
+ },
414
+ [GanttViewType.month]: {
415
+ label: '月',
416
+ dateFormats: {
417
+ primary: `yyyy年'Q'Q`,
418
+ secondary: 'M月'
419
+ }
420
+ },
421
+ [GanttViewType.quarter]: {
422
+ label: '季',
423
+ dateFormats: {
424
+ primary: 'yyyy年',
425
+ secondary: `yyyy年'Q'Q`
426
+ }
427
+ },
428
+ [GanttViewType.year]: {
429
+ label: '年',
430
+ dateFormats: {
431
+ secondary: 'yyyy年'
432
+ }
433
+ }
434
+ }
435
+ };
436
+
437
+ var zhHantLocale = {
438
+ id: GanttI18nLocale.zhHant,
439
+ views: {
440
+ [GanttViewType.hour]: {
441
+ label: '小時',
442
+ dateFormats: {
443
+ primary: 'M月d日',
444
+ secondary: 'HH:mm'
445
+ }
446
+ },
447
+ [GanttViewType.day]: {
448
+ label: '天',
449
+ dateFormats: {
450
+ primary: 'yyyy年MM月',
451
+ secondary: 'd'
452
+ }
453
+ },
454
+ [GanttViewType.week]: {
455
+ label: '週',
456
+ dateFormats: {
457
+ primary: 'yyyy年',
458
+ secondary: '第w週'
459
+ }
460
+ },
461
+ [GanttViewType.month]: {
462
+ label: '月',
463
+ dateFormats: {
464
+ primary: `yyyy年'Q'Q`,
465
+ secondary: 'M月'
466
+ }
467
+ },
468
+ [GanttViewType.quarter]: {
469
+ label: '季',
470
+ dateFormats: {
471
+ primary: 'yyyy年',
472
+ secondary: `yyyy年'Q'Q`
473
+ }
474
+ },
475
+ [GanttViewType.year]: {
476
+ label: '年',
477
+ dateFormats: {
478
+ secondary: 'yyyy年'
479
+ }
480
+ }
481
+ }
482
+ };
483
+
484
+ const defaultConfig = {
485
+ locale: GanttI18nLocale.zhHans,
486
+ linkOptions: {
487
+ dependencyTypes: [GanttLinkType.fs],
488
+ showArrow: false,
489
+ lineType: GanttLinkLineType.curve
490
+ },
491
+ styleOptions: {
492
+ headerHeight: 44,
493
+ lineHeight: 44,
494
+ barHeight: 22
495
+ },
496
+ dateOptions: {
497
+ weekStartsOn: 1
498
+ }
499
+ };
500
+ const GANTT_GLOBAL_CONFIG = new InjectionToken('GANTT_GLOBAL_CONFIG');
501
+ class GanttConfigService {
502
+ constructor() {
503
+ const globalConfig = inject(GANTT_GLOBAL_CONFIG);
504
+ const localeId = globalConfig.locale || defaultConfig.locale;
505
+ this.config = {
506
+ locale: localeId,
507
+ dateFormat: Object.assign({}, defaultConfig.dateFormat, globalConfig.dateFormat),
508
+ styleOptions: Object.assign({}, defaultConfig.styleOptions, globalConfig.styleOptions),
509
+ linkOptions: Object.assign({}, defaultConfig.linkOptions, globalConfig.linkOptions),
510
+ dateOptions: Object.assign({}, defaultConfig.dateOptions, globalConfig.dateOptions)
511
+ };
512
+ this.i18nLocales = inject(GANTT_I18N_LOCALE_TOKEN).reduce((result, localeConfig) => {
513
+ result[localeConfig.id] = localeConfig; // 这里使用 `id` 作为 key
514
+ return result;
515
+ }, {
516
+ ['zh-cn']: zhHansLocale,
517
+ ['zh-tw']: zhHantLocale
518
+ });
519
+ if (this.config.dateOptions?.timeZone) {
520
+ setDefaultTimeZone(this.config.dateOptions.timeZone);
521
+ }
522
+ setDefaultOptions({
523
+ locale: this.getDateLocale(),
524
+ weekStartsOn: this.config?.dateOptions?.weekStartsOn
525
+ });
526
+ }
527
+ setLocale(locale) {
528
+ this.config.locale = locale;
529
+ }
530
+ getLocaleConfig() {
531
+ return this.i18nLocales[this.config.locale] ?? this.i18nLocales[this.config.locale.toLowerCase()] ?? zhHansLocale;
532
+ }
533
+ getViewsLocale() {
534
+ return this.getLocaleConfig().views;
535
+ }
536
+ getDateLocale() {
537
+ return this.config.dateOptions?.locale ?? this.getLocaleConfig().dateLocale;
538
+ }
539
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
540
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttConfigService, providedIn: 'root' }); }
541
+ }
542
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttConfigService, decorators: [{
543
+ type: Injectable,
544
+ args: [{ providedIn: 'root' }]
545
+ }], ctorParameters: () => [] });
546
+
379
547
  function isNumber(value) {
380
548
  return typeof value === 'number';
381
549
  }
@@ -449,118 +617,204 @@ function keyBy(array, key) {
449
617
  return result;
450
618
  }
451
619
 
452
- const scrollThreshold = 50;
453
- var ScrollDirection;
454
- (function (ScrollDirection) {
455
- ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
456
- ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
457
- ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
458
- })(ScrollDirection || (ScrollDirection = {}));
459
- class GanttDomService {
460
- constructor() {
461
- this.ngZone = inject(NgZone);
462
- this.platformId = inject(PLATFORM_ID);
463
- this.visibleRangeX = signal({ min: 0, max: 0 }, ...(ngDevMode ? [{ debugName: "visibleRangeX" }] : []));
464
- this.unsubscribe$ = new Subject();
465
- }
466
- disableBrowserWheelEvent() {
467
- const container = this.mainContainer;
468
- this.ngZone.runOutsideAngular(() => fromEvent(container, 'wheel')
469
- .pipe(takeUntil(this.unsubscribe$))
470
- .subscribe((event) => {
471
- const delta = event.deltaX;
472
- if (!delta) {
473
- return;
620
+ var enUsLocale = {
621
+ id: GanttI18nLocale.enUs,
622
+ views: {
623
+ [GanttViewType.hour]: {
624
+ label: 'Hourly',
625
+ dateFormats: {
626
+ primary: 'MMM d',
627
+ secondary: 'HH:mm'
474
628
  }
475
- if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
476
- (container.scrollLeft === 0 && delta < 0)) {
477
- event.preventDefault();
629
+ },
630
+ [GanttViewType.day]: {
631
+ label: 'Daily',
632
+ dateFormats: {
633
+ primary: 'MMM yyyy',
634
+ secondary: 'd'
478
635
  }
479
- }));
636
+ },
637
+ [GanttViewType.week]: {
638
+ label: 'Weekly',
639
+ dateFormats: {
640
+ primary: 'yyyy',
641
+ secondary: 'wo'
642
+ }
643
+ },
644
+ [GanttViewType.month]: {
645
+ label: 'Monthly',
646
+ dateFormats: {
647
+ primary: "yyyy 'Q'Q",
648
+ secondary: 'MMM'
649
+ }
650
+ },
651
+ [GanttViewType.quarter]: {
652
+ label: 'Quarterly',
653
+ dateFormats: {
654
+ primary: 'yyyy',
655
+ secondary: "yyyy 'Q'Q"
656
+ }
657
+ },
658
+ [GanttViewType.year]: {
659
+ label: 'Yearly',
660
+ dateFormats: {
661
+ secondary: 'yyyy'
662
+ }
663
+ }
480
664
  }
481
- initialize(root) {
482
- this.root = root.nativeElement;
483
- this.side = this.root.getElementsByClassName('gantt-side')[0];
484
- this.container = this.root.getElementsByClassName('gantt-container')[0];
485
- this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
486
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
487
- this.mainScrollbar = this.root.getElementsByClassName('gantt-main-scrollbar')[0];
488
- this.mainFooter = this.root.getElementsByClassName('gantt-container-footer')[0];
489
- this.verticalScrollContainer = this.root.getElementsByClassName('gantt-scroll-container')[0];
490
- const mainItems = this.mainContainer.getElementsByClassName('gantt-main-items')[0];
491
- const mainGroups = this.mainContainer.getElementsByClassName('gantt-main-groups')[0];
492
- this.mainItems = mainItems || mainGroups;
493
- this.calendarHeader = this.root.getElementsByClassName('gantt-calendar-header')[0];
494
- this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-grid')[0];
495
- this.disableBrowserWheelEvent();
496
- }
497
- /**
498
- * @returns An observable that will emit outside the Angular zone. Note, consumers should re-enter the Angular zone
499
- * to run the change detection if needed.
500
- */
501
- getViewerScroll(options) {
502
- const scrollObservers = [fromEvent(this.mainContainer, 'scroll', options)];
503
- this.mainFooter && scrollObservers.push(fromEvent(this.mainFooter, 'scroll', options));
504
- this.mainScrollbar && scrollObservers.push(fromEvent(this.mainScrollbar, 'scroll', options));
505
- return new Observable((subscriber) => this.ngZone.runOutsideAngular(() => merge(...scrollObservers)
506
- .pipe(map(() => this.mainContainer.scrollLeft), pairwise(), map(([previous, current]) => {
507
- this.setVisibleRangeX();
508
- const event = {
509
- target: this.mainContainer,
510
- direction: ScrollDirection.NONE
511
- };
512
- if (current - previous < 0) {
513
- if (this.mainContainer.scrollLeft < scrollThreshold && this.mainContainer.scrollLeft > 0) {
514
- event.direction = ScrollDirection.LEFT;
515
- }
665
+ };
666
+
667
+ var jaJpLocale = {
668
+ id: GanttI18nLocale.jaJp,
669
+ views: {
670
+ [GanttViewType.hour]: {
671
+ label: '毎時',
672
+ dateFormats: {
673
+ primary: 'M月d日',
674
+ secondary: 'HH:mm'
516
675
  }
517
- if (current - previous > 0) {
518
- if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft <
519
- scrollThreshold) {
520
- event.direction = ScrollDirection.RIGHT;
521
- }
676
+ },
677
+ [GanttViewType.day]: {
678
+ label: '日',
679
+ dateFormats: {
680
+ primary: 'yyyy年M月d日',
681
+ secondary: 'd'
682
+ }
683
+ },
684
+ [GanttViewType.week]: {
685
+ label: '週',
686
+ dateFormats: {
687
+ primary: 'yyyy年',
688
+ secondary: '第w週'
689
+ }
690
+ },
691
+ [GanttViewType.month]: {
692
+ label: '月',
693
+ dateFormats: {
694
+ primary: `yyyy年M月`,
695
+ secondary: 'M月'
696
+ }
697
+ },
698
+ [GanttViewType.quarter]: {
699
+ label: '四半期',
700
+ dateFormats: {
701
+ primary: 'yyyy年',
702
+ secondary: `yyyy年第Q四半期`
703
+ }
704
+ },
705
+ [GanttViewType.year]: {
706
+ label: '年',
707
+ dateFormats: {
708
+ secondary: 'yyyy年'
522
709
  }
523
- return event;
524
- }))
525
- .subscribe(subscriber)));
526
- }
527
- getResize() {
528
- return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
529
- }
530
- getResizeByElement(element) {
531
- return new Observable((observer) => {
532
- const resizeObserver = new ResizeObserver(() => {
533
- observer.next(null);
534
- });
535
- resizeObserver.observe(element);
536
- });
537
- }
538
- scrollMainContainer(left) {
539
- if (isNumber(left)) {
540
- const scrollLeft = left - this.mainContainer.clientWidth / 2;
541
- this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
542
- this.calendarHeader.scrollLeft = this.mainContainer.scrollLeft;
543
- this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
544
- this.mainScrollbar && (this.mainScrollbar.scrollLeft = this.mainContainer.scrollLeft);
545
- this.mainFooter && (this.mainFooter.scrollLeft = this.mainContainer.scrollLeft);
546
710
  }
547
711
  }
548
- setVisibleRangeX() {
549
- this.visibleRangeX.set({
550
- min: this.mainContainer.scrollLeft,
551
- max: this.mainContainer.scrollLeft + this.mainContainer.clientWidth
552
- });
712
+ };
713
+
714
+ var deDeLocale = {
715
+ id: GanttI18nLocale.deDe,
716
+ dateLocale: de,
717
+ views: {
718
+ [GanttViewType.hour]: {
719
+ label: 'Stündlich',
720
+ dateFormats: {
721
+ primary: 'dd. MMM',
722
+ secondary: 'HH:mm'
723
+ }
724
+ },
725
+ [GanttViewType.day]: {
726
+ label: 'Täglich',
727
+ dateFormats: {
728
+ primary: 'MMM yyyy',
729
+ secondary: 'd'
730
+ }
731
+ },
732
+ [GanttViewType.week]: {
733
+ label: 'Wöchentlich',
734
+ dateFormats: {
735
+ primary: 'yyyy',
736
+ secondary: `w. 'Woche'`
737
+ }
738
+ },
739
+ [GanttViewType.month]: {
740
+ label: 'Monatlich',
741
+ dateFormats: {
742
+ primary: 'MMM yyyy',
743
+ secondary: 'MMM'
744
+ }
745
+ },
746
+ [GanttViewType.quarter]: {
747
+ label: 'Vierteljährlich',
748
+ dateFormats: {
749
+ primary: 'yyyy',
750
+ secondary: `Q. 'Quartal' yyyy`
751
+ }
752
+ },
753
+ [GanttViewType.year]: {
754
+ label: 'Jährlich',
755
+ dateFormats: {
756
+ secondary: 'yyyy'
757
+ }
758
+ }
553
759
  }
554
- ngOnDestroy() {
555
- this.unsubscribe$.next();
556
- this.unsubscribe$.complete();
760
+ };
761
+
762
+ var ruRuLocale = {
763
+ id: GanttI18nLocale.ruRu,
764
+ dateLocale: ru,
765
+ views: {
766
+ [GanttViewType.hour]: {
767
+ label: 'Ежечасно',
768
+ dateFormats: {
769
+ primary: 'd MMM',
770
+ secondary: 'HH:mm'
771
+ }
772
+ },
773
+ [GanttViewType.day]: {
774
+ label: 'Ежедневно',
775
+ dateFormats: {
776
+ primary: 'MMMM yyyy',
777
+ secondary: 'd'
778
+ }
779
+ },
780
+ [GanttViewType.week]: {
781
+ label: 'Еженедельно',
782
+ dateFormats: {
783
+ primary: 'yyyy',
784
+ secondary: 'Неделя w'
785
+ }
786
+ },
787
+ [GanttViewType.month]: {
788
+ label: 'Ежемесячно',
789
+ dateFormats: {
790
+ primary: 'MMMM yyyy',
791
+ secondary: 'MMM'
792
+ }
793
+ },
794
+ [GanttViewType.quarter]: {
795
+ label: 'Ежеквартально',
796
+ dateFormats: {
797
+ primary: 'yyyy',
798
+ secondary: 'Квартал Q yyyy'
799
+ }
800
+ },
801
+ [GanttViewType.year]: {
802
+ label: 'Ежегодно',
803
+ dateFormats: {
804
+ secondary: 'yyyy'
805
+ }
806
+ }
557
807
  }
558
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDomService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
559
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDomService }); }
560
- }
561
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDomService, decorators: [{
562
- type: Injectable
563
- }], ctorParameters: () => [] });
808
+ };
809
+
810
+ const i18nLocaleProvides = [
811
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: zhHansLocale, multi: true },
812
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: zhHantLocale, multi: true },
813
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: enUsLocale, multi: true },
814
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: jaJpLocale, multi: true },
815
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: deDeLocale, multi: true },
816
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: ruRuLocale, multi: true }
817
+ ];
564
818
 
565
819
  const primaryDatePointTop = '40%';
566
820
  const secondaryDatePointTop = '80%';
@@ -605,6 +859,9 @@ class GanttView {
605
859
  endOf(date) {
606
860
  return this.viewEndOf(date);
607
861
  }
862
+ hideHoliday(date) {
863
+ return this.options.hoilday?.hideHoliday && this.options.hoilday?.isHoliday?.(date);
864
+ }
608
865
  startOfPrecision(date) {
609
866
  switch (this.options.datePrecisionUnit) {
610
867
  case 'minute':
@@ -625,16 +882,6 @@ class GanttView {
625
882
  return date.endOfDay();
626
883
  }
627
884
  }
628
- differenceByPrecisionUnit(dateLeft, dateRight) {
629
- switch (this.options.datePrecisionUnit) {
630
- case 'minute':
631
- return differenceInMinutes(dateLeft.value, dateRight.value);
632
- case 'hour':
633
- return differenceInHours(dateLeft.value, dateRight.value);
634
- default:
635
- return differenceInCalendarDays(dateLeft.value, dateRight.value);
636
- }
637
- }
638
885
  getDateIntervalWidth(start, end) {
639
886
  let result = 0;
640
887
  const days = differenceInDays(end.value, start.value);
@@ -645,10 +892,10 @@ class GanttView {
645
892
  return Number(result.toFixed(3));
646
893
  }
647
894
  initialize() {
895
+ this.cellWidth = this.getCellWidth();
648
896
  this.primaryDatePoints = this.getPrimaryDatePoints();
649
897
  this.secondaryDatePoints = this.getSecondaryDatePoints();
650
898
  this.width = this.getWidth();
651
- this.cellWidth = this.getCellWidth();
652
899
  this.primaryWidth = this.getPrimaryWidth();
653
900
  }
654
901
  addStartDate() {
@@ -734,323 +981,199 @@ class GanttView {
734
981
  return this.getDayOccupancyWidth(date);
735
982
  }
736
983
  }
984
+ // 获取两个日期在当前可见时间轴上的索引差值
985
+ getVisibleDateIndexOffset(start, end) {
986
+ switch (this.options.datePrecisionUnit) {
987
+ case 'minute':
988
+ return differenceInMinutes(end.value, start.value);
989
+ case 'hour':
990
+ return differenceInHours(end.value, start.value);
991
+ default:
992
+ return differenceInCalendarDays(end.value, start.value);
993
+ }
994
+ }
995
+ // 根据基准日期和索引偏移量,获取新的日期
996
+ getDateByIndexOffset(baseDate, indexOffset) {
997
+ return baseDate.add(indexOffset, this.options.datePrecisionUnit);
998
+ }
737
999
  }
738
1000
 
739
- var GanttI18nLocale;
740
- (function (GanttI18nLocale) {
741
- GanttI18nLocale["zhHans"] = "zh-hans";
742
- GanttI18nLocale["zhHant"] = "zh-hant";
743
- GanttI18nLocale["enUs"] = "en-us";
744
- GanttI18nLocale["deDe"] = "de-de";
745
- GanttI18nLocale["jaJp"] = "ja-jp";
746
- GanttI18nLocale["ruRu"] = "ru-ru";
747
- })(GanttI18nLocale || (GanttI18nLocale = {}));
748
- const GANTT_I18N_LOCALE_TOKEN = new InjectionToken('gantt-i18n-locale');
749
-
750
- var zhHans = {
751
- id: GanttI18nLocale.zhHans,
752
- views: {
753
- [GanttViewType.hour]: {
754
- label: '小时',
755
- dateFormats: {
756
- primary: 'M月d日',
757
- secondary: 'HH:mm'
758
- }
759
- },
760
- [GanttViewType.day]: {
761
- label: '天',
762
- dateFormats: {
763
- primary: 'yyyy年MM月',
764
- secondary: 'd'
765
- }
766
- },
767
- [GanttViewType.week]: {
768
- label: '周',
769
- dateFormats: {
770
- primary: 'yyyy年',
771
- secondary: '第w周'
772
- }
773
- },
774
- [GanttViewType.month]: {
775
- label: '月',
776
- dateFormats: {
777
- primary: `yyyy年'Q'Q`,
778
- secondary: 'M月'
779
- }
780
- },
781
- [GanttViewType.quarter]: {
782
- label: '季',
783
- dateFormats: {
784
- primary: 'yyyy年',
785
- secondary: `yyyy年'Q'Q`
786
- }
787
- },
788
- [GanttViewType.year]: {
789
- label: '年',
790
- dateFormats: {
791
- secondary: 'yyyy年'
792
- }
1001
+ const viewOptions$5 = {
1002
+ cellWidth: 35,
1003
+ start: new GanttDate().startOfYear().startOfWeek(),
1004
+ end: new GanttDate().endOfYear().endOfWeek(),
1005
+ addAmount: 1,
1006
+ addUnit: 'month',
1007
+ dateDisplayFormats: zhHantLocale.views.day.dateFormats
1008
+ };
1009
+ class GanttViewDay extends GanttView {
1010
+ constructor(start, end, options) {
1011
+ super(start, end, Object.assign({}, viewOptions$5, options));
1012
+ this.showTimeline = false;
1013
+ this.viewType = GanttViewType.day;
1014
+ }
1015
+ viewStartOf(date) {
1016
+ return date.startOfWeek();
1017
+ }
1018
+ viewEndOf(date) {
1019
+ return date.endOfWeek();
1020
+ }
1021
+ getPrimaryWidth() {
1022
+ return this.getCellWidth() * 7;
1023
+ }
1024
+ getDayOccupancyWidth(date) {
1025
+ if (this.hideHoliday(date)) {
1026
+ return 0;
793
1027
  }
1028
+ return this.cellWidth;
794
1029
  }
795
- };
796
-
797
- var zhHant = {
798
- id: GanttI18nLocale.zhHant,
799
- views: {
800
- [GanttViewType.hour]: {
801
- label: '小時',
802
- dateFormats: {
803
- primary: 'M月d日',
804
- secondary: 'HH:mm'
805
- }
806
- },
807
- [GanttViewType.day]: {
808
- label: '天',
809
- dateFormats: {
810
- primary: 'yyyy年MM月',
811
- secondary: 'd'
812
- }
813
- },
814
- [GanttViewType.week]: {
815
- label: '週',
816
- dateFormats: {
817
- primary: 'yyyy年',
818
- secondary: '第w週'
819
- }
820
- },
821
- [GanttViewType.month]: {
822
- label: '月',
823
- dateFormats: {
824
- primary: `yyyy年'Q'Q`,
825
- secondary: 'M月'
826
- }
827
- },
828
- [GanttViewType.quarter]: {
829
- label: '季',
830
- dateFormats: {
831
- primary: 'yyyy年',
832
- secondary: `yyyy年'Q'Q`
833
- }
834
- },
835
- [GanttViewType.year]: {
836
- label: '年',
837
- dateFormats: {
838
- secondary: 'yyyy年'
839
- }
1030
+ getPrimaryDatePoints() {
1031
+ const weeks = eachWeekOfInterval({ start: this.start.value, end: this.end.addSeconds(1).value });
1032
+ const points = [];
1033
+ for (let i = 0; i < weeks.length; i++) {
1034
+ const weekStart = new GanttDate(weeks[i]);
1035
+ const weekEnd = weekStart.addWeeks(1);
1036
+ const increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
1037
+ const pointWidth = this.getDateIntervalWidth(weekStart, weekEnd);
1038
+ const lastPoint = points[points.length - 1];
1039
+ const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat?.yearMonth || this.options.dateDisplayFormats.primary), pointWidth / 2 + (lastPoint?.rightX || 0), primaryDatePointTop);
1040
+ point.leftX = lastPoint?.rightX || 0;
1041
+ point.rightX = point.leftX + pointWidth;
1042
+ points.push(point);
840
1043
  }
1044
+ return points;
841
1045
  }
842
- };
843
-
844
- var enUsLocale = {
845
- id: GanttI18nLocale.enUs,
846
- views: {
847
- [GanttViewType.hour]: {
848
- label: 'Hourly',
849
- dateFormats: {
850
- primary: 'MMM d',
851
- secondary: 'HH:mm'
852
- }
853
- },
854
- [GanttViewType.day]: {
855
- label: 'Daily',
856
- dateFormats: {
857
- primary: 'MMM yyyy',
858
- secondary: 'd'
859
- }
860
- },
861
- [GanttViewType.week]: {
862
- label: 'Weekly',
863
- dateFormats: {
864
- primary: 'yyyy',
865
- secondary: 'wo'
866
- }
867
- },
868
- [GanttViewType.month]: {
869
- label: 'Monthly',
870
- dateFormats: {
871
- primary: "yyyy 'Q'Q",
872
- secondary: 'MMM'
873
- }
874
- },
875
- [GanttViewType.quarter]: {
876
- label: 'Quarterly',
877
- dateFormats: {
878
- primary: 'yyyy',
879
- secondary: "yyyy 'Q'Q"
880
- }
881
- },
882
- [GanttViewType.year]: {
883
- label: 'Yearly',
884
- dateFormats: {
885
- secondary: 'yyyy'
886
- }
1046
+ getSecondaryDatePoints() {
1047
+ const days = eachDayOfInterval({ start: this.start.value, end: this.end.value }).filter((day) => !this.hideHoliday(new GanttDate(day)));
1048
+ const points = [];
1049
+ for (let i = 0; i < days.length; i++) {
1050
+ const start = new GanttDate(days[i]);
1051
+ const point = new GanttDatePoint(start, start.format(this.options.dateDisplayFormats.secondary) || start.getDate().toString(), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop, {
1052
+ isWeekend: start.isWeekend(),
1053
+ isToday: start.isToday()
1054
+ });
1055
+ points.push(point);
887
1056
  }
1057
+ return points;
888
1058
  }
889
- };
890
-
891
- var jaJpLocale = {
892
- id: GanttI18nLocale.jaJp,
893
- views: {
894
- [GanttViewType.hour]: {
895
- label: '毎時',
896
- dateFormats: {
897
- primary: 'M月d日',
898
- secondary: 'HH:mm'
899
- }
900
- },
901
- [GanttViewType.day]: {
902
- label: '日',
903
- dateFormats: {
904
- primary: 'yyyy年M月d日',
905
- secondary: 'd'
906
- }
907
- },
908
- [GanttViewType.week]: {
909
- label: '週',
910
- dateFormats: {
911
- primary: 'yyyy年',
912
- secondary: '第w週'
913
- }
914
- },
915
- [GanttViewType.month]: {
916
- label: '月',
917
- dateFormats: {
918
- primary: `yyyy年M月`,
919
- secondary: 'M月'
920
- }
921
- },
922
- [GanttViewType.quarter]: {
923
- label: '四半期',
924
- dateFormats: {
925
- primary: 'yyyy年',
926
- secondary: `yyyy年第Q四半期`
927
- }
928
- },
929
- [GanttViewType.year]: {
930
- label: '年',
931
- dateFormats: {
932
- secondary: 'yyyy年'
933
- }
1059
+ // 获取两个日期在当前可见时间轴上的索引差值
1060
+ getVisibleDateIndexOffset(start, end) {
1061
+ const startTime = this.startOfPrecision(start).value;
1062
+ const endTime = this.startOfPrecision(end).value;
1063
+ const startIndex = this.secondaryDatePoints.findIndex((p) => p.start.value >= startTime);
1064
+ const endIndex = this.secondaryDatePoints.findIndex((p) => p.start.value >= endTime);
1065
+ if (startIndex !== -1 && endIndex !== -1) {
1066
+ return endIndex - startIndex;
934
1067
  }
1068
+ return differenceInCalendarDays(endTime, startTime);
935
1069
  }
936
- };
937
-
938
- var deDeLocale = {
939
- id: GanttI18nLocale.deDe,
940
- dateLocale: de,
941
- views: {
942
- [GanttViewType.hour]: {
943
- label: 'Stündlich',
944
- dateFormats: {
945
- primary: 'dd. MMM',
946
- secondary: 'HH:mm'
947
- }
948
- },
949
- [GanttViewType.day]: {
950
- label: 'Täglich',
951
- dateFormats: {
952
- primary: 'MMM yyyy',
953
- secondary: 'd'
954
- }
955
- },
956
- [GanttViewType.week]: {
957
- label: 'Wöchentlich',
958
- dateFormats: {
959
- primary: 'yyyy',
960
- secondary: `w. 'Woche'`
961
- }
962
- },
963
- [GanttViewType.month]: {
964
- label: 'Monatlich',
965
- dateFormats: {
966
- primary: 'MMM yyyy',
967
- secondary: 'MMM'
968
- }
969
- },
970
- [GanttViewType.quarter]: {
971
- label: 'Vierteljährlich',
972
- dateFormats: {
973
- primary: 'yyyy',
974
- secondary: `Q. 'Quartal' yyyy`
975
- }
976
- },
977
- [GanttViewType.year]: {
978
- label: 'Jährlich',
979
- dateFormats: {
980
- secondary: 'yyyy'
981
- }
1070
+ // 根据基准日期和索引偏移量,获取新的日期
1071
+ getDateByIndexOffset(baseDate, indexOffset) {
1072
+ const baseTime = this.startOfPrecision(baseDate).value;
1073
+ const baseIndex = this.secondaryDatePoints.findIndex((p) => p.start.value >= baseTime);
1074
+ if (baseIndex !== -1) {
1075
+ const targetIndex = baseIndex + indexOffset;
1076
+ const safeIndex = Math.max(0, Math.min(targetIndex, this.secondaryDatePoints.length - 1));
1077
+ return this.secondaryDatePoints[safeIndex].start;
982
1078
  }
1079
+ return baseDate.addDays(indexOffset);
983
1080
  }
984
- };
1081
+ }
985
1082
 
986
- var ruRuLocale = {
987
- id: GanttI18nLocale.ruRu,
988
- dateLocale: ru,
989
- views: {
990
- [GanttViewType.hour]: {
991
- label: 'Ежечасно',
992
- dateFormats: {
993
- primary: 'd MMM',
994
- secondary: 'HH:mm'
995
- }
996
- },
997
- [GanttViewType.day]: {
998
- label: 'Ежедневно',
999
- dateFormats: {
1000
- primary: 'MMMM yyyy',
1001
- secondary: 'd'
1002
- }
1003
- },
1004
- [GanttViewType.week]: {
1005
- label: 'Еженедельно',
1006
- dateFormats: {
1007
- primary: 'yyyy',
1008
- secondary: 'Неделя w'
1009
- }
1010
- },
1011
- [GanttViewType.month]: {
1012
- label: 'Ежемесячно',
1013
- dateFormats: {
1014
- primary: 'MMMM yyyy',
1015
- secondary: 'MMM'
1016
- }
1017
- },
1018
- [GanttViewType.quarter]: {
1019
- label: 'Ежеквартально',
1020
- dateFormats: {
1021
- primary: 'yyyy',
1022
- secondary: 'Квартал Q yyyy'
1023
- }
1024
- },
1025
- [GanttViewType.year]: {
1026
- label: 'Ежегодно',
1027
- dateFormats: {
1028
- secondary: 'yyyy'
1029
- }
1083
+ const viewOptions$4 = {
1084
+ cellWidth: 80,
1085
+ start: new GanttDate().startOfMonth(),
1086
+ end: new GanttDate().endOfMonth(),
1087
+ datePrecisionUnit: 'minute',
1088
+ addAmount: 1,
1089
+ addUnit: 'week',
1090
+ dateDisplayFormats: zhHantLocale.views.hour.dateFormats,
1091
+ dragPreviewDateFormat: 'HH:mm'
1092
+ };
1093
+ class GanttViewHour extends GanttView {
1094
+ constructor(start, end, options) {
1095
+ super(start, end, Object.assign({}, viewOptions$4, options));
1096
+ this.showTimeline = true;
1097
+ this.viewType = GanttViewType.hour;
1098
+ }
1099
+ viewStartOf(date) {
1100
+ return date.startOfWeek();
1101
+ }
1102
+ viewEndOf(date) {
1103
+ return date.endOfWeek();
1104
+ }
1105
+ getPrimaryWidth() {
1106
+ return this.getCellWidth() * 24;
1107
+ }
1108
+ getDayOccupancyWidth() {
1109
+ return this.cellWidth * 60;
1110
+ }
1111
+ getHourOccupancyWidth() {
1112
+ return this.getDayOccupancyWidth() / 60;
1113
+ }
1114
+ getPrimaryDatePoints() {
1115
+ const days = eachDayOfInterval({ start: this.start.value, end: this.end.value });
1116
+ const points = [];
1117
+ for (let i = 0; i < days.length; i++) {
1118
+ const start = this.start.addDays(i);
1119
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.day || this.options.dateDisplayFormats.primary), (this.getCellWidth() * 24) / 2 + i * (this.getCellWidth() * 24), primaryDatePointTop);
1120
+ points.push(point);
1030
1121
  }
1122
+ return points;
1031
1123
  }
1032
- };
1033
-
1034
- const i18nLocaleProvides = [
1035
- { provide: GANTT_I18N_LOCALE_TOKEN, useValue: zhHans, multi: true },
1036
- { provide: GANTT_I18N_LOCALE_TOKEN, useValue: zhHant, multi: true },
1037
- { provide: GANTT_I18N_LOCALE_TOKEN, useValue: enUsLocale, multi: true },
1038
- { provide: GANTT_I18N_LOCALE_TOKEN, useValue: jaJpLocale, multi: true },
1039
- { provide: GANTT_I18N_LOCALE_TOKEN, useValue: deDeLocale, multi: true },
1040
- { provide: GANTT_I18N_LOCALE_TOKEN, useValue: ruRuLocale, multi: true }
1041
- ];
1124
+ getSecondaryDatePoints() {
1125
+ const hours = eachHourOfInterval({ start: this.start.value, end: this.end.value });
1126
+ const points = [];
1127
+ for (let i = 0; i < hours.length; i++) {
1128
+ const start = new GanttDate(hours[i]);
1129
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.hour || this.options.dateDisplayFormats.secondary), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop, {
1130
+ isWeekend: start.isWeekend(),
1131
+ isToday: start.isToday()
1132
+ });
1133
+ points.push(point);
1134
+ }
1135
+ return points;
1136
+ }
1137
+ getTodayXPoint() {
1138
+ const toady = new GanttDate().startOfMinute();
1139
+ if (toady.value > this.start.value && toady.value < this.end.value) {
1140
+ const x = this.getXPointByDate(toady);
1141
+ return x;
1142
+ }
1143
+ else {
1144
+ return null;
1145
+ }
1146
+ }
1147
+ getDateIntervalWidth(start, end) {
1148
+ let result = 0;
1149
+ const minutes = differenceInMinutes(end.value, start.value);
1150
+ for (let i = 0; i < minutes; i++) {
1151
+ result += this.getHourOccupancyWidth() / 60;
1152
+ }
1153
+ result = minutes >= 0 ? result : -result;
1154
+ return Number(result.toFixed(3));
1155
+ }
1156
+ getDateByXPoint(x) {
1157
+ const hourWidth = this.getHourOccupancyWidth();
1158
+ const indexOfSecondaryDate = Math.max(Math.floor(x / hourWidth), 0);
1159
+ const matchDate = this.secondaryDatePoints[Math.min(this.secondaryDatePoints.length - 1, indexOfSecondaryDate)];
1160
+ const minuteWidth = hourWidth / 60;
1161
+ const underOneHourMinutes = Math.floor((x % hourWidth) / minuteWidth);
1162
+ return matchDate?.start.addMinutes(underOneHourMinutes);
1163
+ }
1164
+ }
1042
1165
 
1043
- const viewOptions$5 = {
1166
+ const viewOptions$3 = {
1044
1167
  start: new GanttDate().startOfQuarter().addQuarters(-1),
1045
1168
  end: new GanttDate().endOfQuarter().addQuarters(2),
1046
1169
  cellWidth: 280,
1047
1170
  addAmount: 1,
1048
1171
  addUnit: 'quarter',
1049
- dateDisplayFormats: zhHant.views.month.dateFormats
1172
+ dateDisplayFormats: zhHantLocale.views.month.dateFormats
1050
1173
  };
1051
1174
  class GanttViewMonth extends GanttView {
1052
1175
  constructor(start, end, options) {
1053
- super(start, end, Object.assign({}, viewOptions$5, options));
1176
+ super(start, end, Object.assign({}, viewOptions$3, options));
1054
1177
  this.viewType = GanttViewType.month;
1055
1178
  }
1056
1179
  viewStartOf(date) {
@@ -1087,7 +1210,7 @@ class GanttViewMonth extends GanttView {
1087
1210
  }
1088
1211
  }
1089
1212
 
1090
- const viewOptions$4 = {
1213
+ const viewOptions$2 = {
1091
1214
  start: new GanttDate().addYears(-1).startOfYear(),
1092
1215
  end: new GanttDate().addYears(1).endOfYear(),
1093
1216
  min: new GanttDate().addYears(-2).startOfYear(),
@@ -1095,11 +1218,11 @@ const viewOptions$4 = {
1095
1218
  cellWidth: 500,
1096
1219
  addAmount: 1,
1097
1220
  addUnit: 'year',
1098
- dateDisplayFormats: zhHant.views.quarter.dateFormats
1221
+ dateDisplayFormats: zhHantLocale.views.quarter.dateFormats
1099
1222
  };
1100
1223
  class GanttViewQuarter extends GanttView {
1101
1224
  constructor(start, end, options) {
1102
- super(start, end, Object.assign({}, viewOptions$4, options));
1225
+ super(start, end, Object.assign({}, viewOptions$2, options));
1103
1226
  this.viewType = GanttViewType.quarter;
1104
1227
  }
1105
1228
  viewStartOf(date) {
@@ -1124,81 +1247,29 @@ class GanttViewQuarter extends GanttView {
1124
1247
  }
1125
1248
  return points;
1126
1249
  }
1127
- getSecondaryDatePoints() {
1128
- const quarters = differenceInCalendarQuarters(this.end.value, this.start.value);
1129
- const points = [];
1130
- for (let i = 0; i <= quarters; i++) {
1131
- const start = this.start.addQuarters(i);
1132
- const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.quarter || this.options.dateDisplayFormats.secondary), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
1133
- points.push(point);
1134
- }
1135
- return points;
1136
- }
1137
- }
1138
-
1139
- const viewOptions$3 = {
1140
- cellWidth: 35,
1141
- start: new GanttDate().startOfYear().startOfWeek(),
1142
- end: new GanttDate().endOfYear().endOfWeek(),
1143
- addAmount: 1,
1144
- addUnit: 'month',
1145
- dateDisplayFormats: zhHant.views.day.dateFormats
1146
- };
1147
- class GanttViewDay extends GanttView {
1148
- constructor(start, end, options) {
1149
- super(start, end, Object.assign({}, viewOptions$3, options));
1150
- this.showTimeline = false;
1151
- this.viewType = GanttViewType.day;
1152
- }
1153
- viewStartOf(date) {
1154
- return date.startOfWeek();
1155
- }
1156
- viewEndOf(date) {
1157
- return date.endOfWeek();
1158
- }
1159
- getPrimaryWidth() {
1160
- return this.getCellWidth() * 7;
1161
- }
1162
- getDayOccupancyWidth() {
1163
- return this.cellWidth;
1164
- }
1165
- getPrimaryDatePoints() {
1166
- const weeks = eachWeekOfInterval({ start: this.start.value, end: this.end.addSeconds(1).value });
1167
- const points = [];
1168
- for (let i = 0; i < weeks.length; i++) {
1169
- const weekStart = new GanttDate(weeks[i]);
1170
- const increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
1171
- 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);
1172
- points.push(point);
1173
- }
1174
- return points;
1175
- }
1176
- getSecondaryDatePoints() {
1177
- const days = eachDayOfInterval({ start: this.start.value, end: this.end.value });
1178
- const points = [];
1179
- for (let i = 0; i < days.length; i++) {
1180
- const start = new GanttDate(days[i]);
1181
- const point = new GanttDatePoint(start, start.format(this.options.dateDisplayFormats.secondary) || start.getDate().toString(), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop, {
1182
- isWeekend: start.isWeekend(),
1183
- isToday: start.isToday()
1184
- });
1250
+ getSecondaryDatePoints() {
1251
+ const quarters = differenceInCalendarQuarters(this.end.value, this.start.value);
1252
+ const points = [];
1253
+ for (let i = 0; i <= quarters; i++) {
1254
+ const start = this.start.addQuarters(i);
1255
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.quarter || this.options.dateDisplayFormats.secondary), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
1185
1256
  points.push(point);
1186
1257
  }
1187
1258
  return points;
1188
1259
  }
1189
1260
  }
1190
1261
 
1191
- const viewOptions$2 = {
1262
+ const viewOptions$1 = {
1192
1263
  cellWidth: 280,
1193
1264
  start: new GanttDate().startOfYear().startOfWeek(),
1194
1265
  end: new GanttDate().endOfYear().endOfWeek(),
1195
1266
  addAmount: 1,
1196
1267
  addUnit: 'month',
1197
- dateDisplayFormats: zhHant.views.week.dateFormats
1268
+ dateDisplayFormats: zhHantLocale.views.week.dateFormats
1198
1269
  };
1199
1270
  class GanttViewWeek extends GanttView {
1200
1271
  constructor(start, end, options) {
1201
- super(start, end, Object.assign({}, viewOptions$2, options));
1272
+ super(start, end, Object.assign({}, viewOptions$1, options));
1202
1273
  this.viewType = GanttViewType.week;
1203
1274
  }
1204
1275
  viewStartOf(date) {
@@ -1236,17 +1307,17 @@ class GanttViewWeek extends GanttView {
1236
1307
  }
1237
1308
  }
1238
1309
 
1239
- const viewOptions$1 = {
1310
+ const viewOptions = {
1240
1311
  cellWidth: 480,
1241
1312
  start: new GanttDate().addYears(-2).startOfYear(),
1242
1313
  end: new GanttDate().addYears(2).endOfYear(),
1243
1314
  addAmount: 1,
1244
1315
  addUnit: 'year',
1245
- dateDisplayFormats: zhHant.views.year.dateFormats
1316
+ dateDisplayFormats: zhHantLocale.views.year.dateFormats
1246
1317
  };
1247
1318
  class GanttViewYear extends GanttView {
1248
1319
  constructor(start, end, options) {
1249
- super(start, end, Object.assign({}, viewOptions$1, options));
1320
+ super(start, end, Object.assign({}, viewOptions, options));
1250
1321
  this.viewType = GanttViewType.year;
1251
1322
  }
1252
1323
  viewStartOf(date) {
@@ -1284,89 +1355,6 @@ class GanttViewYear extends GanttView {
1284
1355
  }
1285
1356
  }
1286
1357
 
1287
- const viewOptions = {
1288
- cellWidth: 80,
1289
- start: new GanttDate().startOfMonth(),
1290
- end: new GanttDate().endOfMonth(),
1291
- datePrecisionUnit: 'minute',
1292
- addAmount: 1,
1293
- addUnit: 'week',
1294
- dateDisplayFormats: zhHant.views.hour.dateFormats,
1295
- dragPreviewDateFormat: 'HH:mm'
1296
- };
1297
- class GanttViewHour extends GanttView {
1298
- constructor(start, end, options) {
1299
- super(start, end, Object.assign({}, viewOptions, options));
1300
- this.showTimeline = true;
1301
- this.viewType = GanttViewType.hour;
1302
- }
1303
- viewStartOf(date) {
1304
- return date.startOfWeek();
1305
- }
1306
- viewEndOf(date) {
1307
- return date.endOfWeek();
1308
- }
1309
- getPrimaryWidth() {
1310
- return this.getCellWidth() * 24;
1311
- }
1312
- getDayOccupancyWidth() {
1313
- return this.cellWidth * 60;
1314
- }
1315
- getHourOccupancyWidth() {
1316
- return this.getDayOccupancyWidth() / 60;
1317
- }
1318
- getPrimaryDatePoints() {
1319
- const days = eachDayOfInterval({ start: this.start.value, end: this.end.value });
1320
- const points = [];
1321
- for (let i = 0; i < days.length; i++) {
1322
- const start = this.start.addDays(i);
1323
- const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.day || this.options.dateDisplayFormats.primary), (this.getCellWidth() * 24) / 2 + i * (this.getCellWidth() * 24), primaryDatePointTop);
1324
- points.push(point);
1325
- }
1326
- return points;
1327
- }
1328
- getSecondaryDatePoints() {
1329
- const hours = eachHourOfInterval({ start: this.start.value, end: this.end.value });
1330
- const points = [];
1331
- for (let i = 0; i < hours.length; i++) {
1332
- const start = new GanttDate(hours[i]);
1333
- const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.hour || this.options.dateDisplayFormats.secondary), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop, {
1334
- isWeekend: start.isWeekend(),
1335
- isToday: start.isToday()
1336
- });
1337
- points.push(point);
1338
- }
1339
- return points;
1340
- }
1341
- getTodayXPoint() {
1342
- const toady = new GanttDate().startOfMinute();
1343
- if (toady.value > this.start.value && toady.value < this.end.value) {
1344
- const x = this.getXPointByDate(toady);
1345
- return x;
1346
- }
1347
- else {
1348
- return null;
1349
- }
1350
- }
1351
- getDateIntervalWidth(start, end) {
1352
- let result = 0;
1353
- const minutes = differenceInMinutes(end.value, start.value);
1354
- for (let i = 0; i < minutes; i++) {
1355
- result += this.getHourOccupancyWidth() / 60;
1356
- }
1357
- result = minutes >= 0 ? result : -result;
1358
- return Number(result.toFixed(3));
1359
- }
1360
- getDateByXPoint(x) {
1361
- const hourWidth = this.getHourOccupancyWidth();
1362
- const indexOfSecondaryDate = Math.max(Math.floor(x / hourWidth), 0);
1363
- const matchDate = this.secondaryDatePoints[Math.min(this.secondaryDatePoints.length - 1, indexOfSecondaryDate)];
1364
- const minuteWidth = hourWidth / 60;
1365
- const underOneHourMinutes = Math.floor((x % hourWidth) / minuteWidth);
1366
- return matchDate?.start.addMinutes(underOneHourMinutes);
1367
- }
1368
- }
1369
-
1370
1358
  const ganttViewsMap = {
1371
1359
  [GanttViewType.hour]: GanttViewHour,
1372
1360
  [GanttViewType.day]: GanttViewDay,
@@ -1382,69 +1370,6 @@ function createViewFactory(type, start, end, options) {
1382
1370
  return new ganttViewsMap[type](start, end, options);
1383
1371
  }
1384
1372
 
1385
- const defaultConfig = {
1386
- locale: GanttI18nLocale.zhHans,
1387
- linkOptions: {
1388
- dependencyTypes: [GanttLinkType.fs],
1389
- showArrow: false,
1390
- lineType: GanttLinkLineType.curve
1391
- },
1392
- styleOptions: {
1393
- headerHeight: 44,
1394
- lineHeight: 44,
1395
- barHeight: 22
1396
- },
1397
- dateOptions: {
1398
- weekStartsOn: 1
1399
- }
1400
- };
1401
- const GANTT_GLOBAL_CONFIG = new InjectionToken('GANTT_GLOBAL_CONFIG');
1402
- class GanttConfigService {
1403
- constructor() {
1404
- const globalConfig = inject(GANTT_GLOBAL_CONFIG);
1405
- const localeId = globalConfig.locale || defaultConfig.locale;
1406
- this.config = {
1407
- locale: localeId,
1408
- dateFormat: Object.assign({}, defaultConfig.dateFormat, globalConfig.dateFormat),
1409
- styleOptions: Object.assign({}, defaultConfig.styleOptions, globalConfig.styleOptions),
1410
- linkOptions: Object.assign({}, defaultConfig.linkOptions, globalConfig.linkOptions),
1411
- dateOptions: Object.assign({}, defaultConfig.dateOptions, globalConfig.dateOptions)
1412
- };
1413
- this.i18nLocales = inject(GANTT_I18N_LOCALE_TOKEN).reduce((result, localeConfig) => {
1414
- result[localeConfig.id] = localeConfig; // 这里使用 `id` 作为 key
1415
- return result;
1416
- }, {
1417
- ['zh-cn']: zhHans,
1418
- ['zh-tw']: zhHant
1419
- });
1420
- if (this.config.dateOptions?.timeZone) {
1421
- setDefaultTimeZone(this.config.dateOptions.timeZone);
1422
- }
1423
- setDefaultOptions({
1424
- locale: this.getDateLocale(),
1425
- weekStartsOn: this.config?.dateOptions?.weekStartsOn
1426
- });
1427
- }
1428
- setLocale(locale) {
1429
- this.config.locale = locale;
1430
- }
1431
- getLocaleConfig() {
1432
- return this.i18nLocales[this.config.locale] ?? this.i18nLocales[this.config.locale.toLowerCase()] ?? zhHans;
1433
- }
1434
- getViewsLocale() {
1435
- return this.getLocaleConfig().views;
1436
- }
1437
- getDateLocale() {
1438
- return this.config.dateOptions?.locale ?? this.getLocaleConfig().dateLocale;
1439
- }
1440
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1441
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttConfigService, providedIn: 'root' }); }
1442
- }
1443
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttConfigService, decorators: [{
1444
- type: Injectable,
1445
- args: [{ providedIn: 'root' }]
1446
- }], ctorParameters: () => [] });
1447
-
1448
1373
  class GanttUpper {
1449
1374
  set linkOptions(options) {
1450
1375
  this._linkOptions = options;
@@ -1844,66 +1769,245 @@ function getDependencyType(path, dependencyTypes) {
1844
1769
  if (dependencyTypes.includes(GanttLinkType.ff) && path.from.pos === InBarPosition.finish && path.to.pos === InBarPosition.finish) {
1845
1770
  return GanttLinkType.ff;
1846
1771
  }
1847
- if (dependencyTypes.includes(GanttLinkType.sf) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.finish) {
1848
- return GanttLinkType.sf;
1772
+ if (dependencyTypes.includes(GanttLinkType.sf) && path.from.pos === InBarPosition.start && path.to.pos === InBarPosition.finish) {
1773
+ return GanttLinkType.sf;
1774
+ }
1775
+ return GanttLinkType.fs;
1776
+ }
1777
+ var InBarPosition;
1778
+ (function (InBarPosition) {
1779
+ InBarPosition["start"] = "start";
1780
+ InBarPosition["finish"] = "finish";
1781
+ })(InBarPosition || (InBarPosition = {}));
1782
+ class GanttDragContainer {
1783
+ constructor() {
1784
+ this.ganttUpper = inject(GANTT_UPPER_TOKEN);
1785
+ this.dragStarted = new EventEmitter();
1786
+ this.dragMoved = new EventEmitter();
1787
+ this.dragEnded = new EventEmitter();
1788
+ this.linkDragStarted = new EventEmitter();
1789
+ this.linkDragEntered = new EventEmitter();
1790
+ this.linkDragEnded = new EventEmitter();
1791
+ this.linkDragPath = { from: null, to: null };
1792
+ }
1793
+ emitLinkDragStarted(from) {
1794
+ this.linkDraggingId = from.item.id;
1795
+ this.linkDragPath.from = from;
1796
+ this.linkDragStarted.emit({
1797
+ source: from.item.origin,
1798
+ target: null
1799
+ });
1800
+ }
1801
+ emitLinkDragEntered(to) {
1802
+ this.linkDragPath.to = to;
1803
+ this.linkDragEntered.emit({
1804
+ source: this.linkDragPath.from.item.origin,
1805
+ target: to.item.origin
1806
+ });
1807
+ }
1808
+ emitLinkDragLeaved() {
1809
+ this.linkDragPath.to = null;
1810
+ }
1811
+ emitLinkDragEnded(to) {
1812
+ if (to) {
1813
+ this.linkDragPath.to = to;
1814
+ const dependencyType = getDependencyType(this.linkDragPath, this.ganttUpper.linkOptions?.dependencyTypes);
1815
+ this.linkDragPath.from.item.addLink({
1816
+ link: this.linkDragPath.to.item.id,
1817
+ type: dependencyType
1818
+ });
1819
+ this.linkDragEnded.emit({
1820
+ source: this.linkDragPath.from.item.origin,
1821
+ target: this.linkDragPath.to.item.origin,
1822
+ type: dependencyType
1823
+ });
1824
+ }
1825
+ this.linkDraggingId = null;
1826
+ this.linkDragPath = { from: null, to: null };
1827
+ }
1828
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDragContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1829
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDragContainer }); }
1830
+ }
1831
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDragContainer, decorators: [{
1832
+ type: Injectable
1833
+ }], ctorParameters: () => [] });
1834
+
1835
+ const sideWidth = 400;
1836
+ const sideMiddleWidth = 500;
1837
+ const sideMaxWidth = 600;
1838
+ const sideMinWidth = 400;
1839
+ const barBackground = '#6698ff';
1840
+ const rangeHeight = 17;
1841
+ const todayHeight = 24;
1842
+ const todayWidth = 35;
1843
+ const todayBorderRadius = 4;
1844
+
1845
+ class GanttItemUpper {
1846
+ constructor() {
1847
+ this.elementRef = inject(ElementRef);
1848
+ this.ganttUpper = inject(GANTT_UPPER_TOKEN);
1849
+ this.firstChange = true;
1850
+ this.unsubscribe$ = new Subject();
1851
+ this.refsUnsubscribe$ = new Subject();
1852
+ }
1853
+ ngOnInit() {
1854
+ this.firstChange = false;
1855
+ this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
1856
+ this.setPositions();
1857
+ });
1858
+ }
1859
+ ngOnChanges(changes) {
1860
+ if (!this.firstChange) {
1861
+ this.itemChange(changes.item.currentValue);
1862
+ }
1863
+ }
1864
+ itemChange(item) {
1865
+ this.refsUnsubscribe$.next();
1866
+ this.refsUnsubscribe$.complete();
1867
+ this.item = item;
1868
+ this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
1869
+ this.setPositions();
1870
+ });
1871
+ }
1872
+ setPositions() {
1873
+ const itemElement = this.elementRef.nativeElement;
1874
+ itemElement.style.left = this.item.refs?.x + 'px';
1875
+ itemElement.style.top = this.item.refs?.y + 'px';
1876
+ itemElement.style.width = this.item.refs?.width + 'px';
1877
+ if (this.item.type === GanttItemType.bar) {
1878
+ itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
1879
+ }
1880
+ else if (this.item.type === GanttItemType.range) {
1881
+ itemElement.style.height = rangeHeight + 'px';
1882
+ }
1849
1883
  }
1850
- return GanttLinkType.fs;
1884
+ ngOnDestroy() {
1885
+ this.unsubscribe$.next();
1886
+ this.unsubscribe$.complete();
1887
+ this.refsUnsubscribe$.next();
1888
+ this.refsUnsubscribe$.complete();
1889
+ }
1890
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttItemUpper, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1891
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.10", type: GanttItemUpper, isStandalone: true, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0 }); }
1851
1892
  }
1852
- var InBarPosition;
1853
- (function (InBarPosition) {
1854
- InBarPosition["start"] = "start";
1855
- InBarPosition["finish"] = "finish";
1856
- })(InBarPosition || (InBarPosition = {}));
1857
- class GanttDragContainer {
1893
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttItemUpper, decorators: [{
1894
+ type: Directive
1895
+ }], ctorParameters: () => [], propDecorators: { template: [{
1896
+ type: Input
1897
+ }], item: [{
1898
+ type: Input
1899
+ }] } });
1900
+
1901
+ const scrollThreshold = 50;
1902
+ var ScrollDirection;
1903
+ (function (ScrollDirection) {
1904
+ ScrollDirection[ScrollDirection["NONE"] = 0] = "NONE";
1905
+ ScrollDirection[ScrollDirection["LEFT"] = 1] = "LEFT";
1906
+ ScrollDirection[ScrollDirection["RIGHT"] = 2] = "RIGHT";
1907
+ })(ScrollDirection || (ScrollDirection = {}));
1908
+ class GanttDomService {
1858
1909
  constructor() {
1859
- this.ganttUpper = inject(GANTT_UPPER_TOKEN);
1860
- this.dragStarted = new EventEmitter();
1861
- this.dragMoved = new EventEmitter();
1862
- this.dragEnded = new EventEmitter();
1863
- this.linkDragStarted = new EventEmitter();
1864
- this.linkDragEntered = new EventEmitter();
1865
- this.linkDragEnded = new EventEmitter();
1866
- this.linkDragPath = { from: null, to: null };
1910
+ this.ngZone = inject(NgZone);
1911
+ this.platformId = inject(PLATFORM_ID);
1912
+ this.visibleRangeX = signal({ min: 0, max: 0 }, ...(ngDevMode ? [{ debugName: "visibleRangeX" }] : []));
1913
+ this.unsubscribe$ = new Subject();
1867
1914
  }
1868
- emitLinkDragStarted(from) {
1869
- this.linkDraggingId = from.item.id;
1870
- this.linkDragPath.from = from;
1871
- this.linkDragStarted.emit({
1872
- source: from.item.origin,
1873
- target: null
1874
- });
1915
+ disableBrowserWheelEvent() {
1916
+ const container = this.mainContainer;
1917
+ this.ngZone.runOutsideAngular(() => fromEvent(container, 'wheel')
1918
+ .pipe(takeUntil(this.unsubscribe$))
1919
+ .subscribe((event) => {
1920
+ const delta = event.deltaX;
1921
+ if (!delta) {
1922
+ return;
1923
+ }
1924
+ if ((container.scrollLeft + container.offsetWidth === container.scrollWidth && delta > 0) ||
1925
+ (container.scrollLeft === 0 && delta < 0)) {
1926
+ event.preventDefault();
1927
+ }
1928
+ }));
1875
1929
  }
1876
- emitLinkDragEntered(to) {
1877
- this.linkDragPath.to = to;
1878
- this.linkDragEntered.emit({
1879
- source: this.linkDragPath.from.item.origin,
1880
- target: to.item.origin
1881
- });
1930
+ initialize(root) {
1931
+ this.root = root.nativeElement;
1932
+ this.side = this.root.getElementsByClassName('gantt-side')[0];
1933
+ this.container = this.root.getElementsByClassName('gantt-container')[0];
1934
+ this.sideContainer = this.root.getElementsByClassName('gantt-side-container')[0];
1935
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
1936
+ this.mainScrollbar = this.root.getElementsByClassName('gantt-main-scrollbar')[0];
1937
+ this.mainFooter = this.root.getElementsByClassName('gantt-container-footer')[0];
1938
+ this.verticalScrollContainer = this.root.getElementsByClassName('gantt-scroll-container')[0];
1939
+ const mainItems = this.mainContainer.getElementsByClassName('gantt-main-items')[0];
1940
+ const mainGroups = this.mainContainer.getElementsByClassName('gantt-main-groups')[0];
1941
+ this.mainItems = mainItems || mainGroups;
1942
+ this.calendarHeader = this.root.getElementsByClassName('gantt-calendar-header')[0];
1943
+ this.calendarOverlay = this.root.getElementsByClassName('gantt-calendar-grid')[0];
1944
+ this.disableBrowserWheelEvent();
1882
1945
  }
1883
- emitLinkDragLeaved() {
1884
- this.linkDragPath.to = null;
1946
+ /**
1947
+ * @returns An observable that will emit outside the Angular zone. Note, consumers should re-enter the Angular zone
1948
+ * to run the change detection if needed.
1949
+ */
1950
+ getViewerScroll(options) {
1951
+ const scrollObservers = [fromEvent(this.mainContainer, 'scroll', options)];
1952
+ this.mainFooter && scrollObservers.push(fromEvent(this.mainFooter, 'scroll', options));
1953
+ this.mainScrollbar && scrollObservers.push(fromEvent(this.mainScrollbar, 'scroll', options));
1954
+ return new Observable((subscriber) => this.ngZone.runOutsideAngular(() => merge(...scrollObservers)
1955
+ .pipe(map(() => this.mainContainer.scrollLeft), pairwise(), map(([previous, current]) => {
1956
+ this.setVisibleRangeX();
1957
+ const event = {
1958
+ target: this.mainContainer,
1959
+ direction: ScrollDirection.NONE
1960
+ };
1961
+ if (current - previous < 0) {
1962
+ if (this.mainContainer.scrollLeft < scrollThreshold && this.mainContainer.scrollLeft > 0) {
1963
+ event.direction = ScrollDirection.LEFT;
1964
+ }
1965
+ }
1966
+ if (current - previous > 0) {
1967
+ if (this.mainContainer.scrollWidth - this.mainContainer.clientWidth - this.mainContainer.scrollLeft <
1968
+ scrollThreshold) {
1969
+ event.direction = ScrollDirection.RIGHT;
1970
+ }
1971
+ }
1972
+ return event;
1973
+ }))
1974
+ .subscribe(subscriber)));
1885
1975
  }
1886
- emitLinkDragEnded(to) {
1887
- if (to) {
1888
- this.linkDragPath.to = to;
1889
- const dependencyType = getDependencyType(this.linkDragPath, this.ganttUpper.linkOptions?.dependencyTypes);
1890
- this.linkDragPath.from.item.addLink({
1891
- link: this.linkDragPath.to.item.id,
1892
- type: dependencyType
1893
- });
1894
- this.linkDragEnded.emit({
1895
- source: this.linkDragPath.from.item.origin,
1896
- target: this.linkDragPath.to.item.origin,
1897
- type: dependencyType
1976
+ getResize() {
1977
+ return isPlatformServer(this.platformId) ? EMPTY : fromEvent(window, 'resize').pipe(auditTime(150));
1978
+ }
1979
+ getResizeByElement(element) {
1980
+ return new Observable((observer) => {
1981
+ const resizeObserver = new ResizeObserver(() => {
1982
+ observer.next(null);
1898
1983
  });
1984
+ resizeObserver.observe(element);
1985
+ });
1986
+ }
1987
+ scrollMainContainer(left) {
1988
+ if (isNumber(left)) {
1989
+ const scrollLeft = left - this.mainContainer.clientWidth / 2;
1990
+ this.mainContainer.scrollLeft = scrollLeft > scrollThreshold ? scrollLeft : 0;
1991
+ this.calendarHeader.scrollLeft = this.mainContainer.scrollLeft;
1992
+ this.calendarOverlay.scrollLeft = this.mainContainer.scrollLeft;
1993
+ this.mainScrollbar && (this.mainScrollbar.scrollLeft = this.mainContainer.scrollLeft);
1994
+ this.mainFooter && (this.mainFooter.scrollLeft = this.mainContainer.scrollLeft);
1899
1995
  }
1900
- this.linkDraggingId = null;
1901
- this.linkDragPath = { from: null, to: null };
1902
1996
  }
1903
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDragContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1904
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDragContainer }); }
1997
+ setVisibleRangeX() {
1998
+ this.visibleRangeX.set({
1999
+ min: this.mainContainer.scrollLeft,
2000
+ max: this.mainContainer.scrollLeft + this.mainContainer.clientWidth
2001
+ });
2002
+ }
2003
+ ngOnDestroy() {
2004
+ this.unsubscribe$.next();
2005
+ this.unsubscribe$.complete();
2006
+ }
2007
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDomService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2008
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDomService }); }
1905
2009
  }
1906
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDragContainer, decorators: [{
2010
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDomService, decorators: [{
1907
2011
  type: Injectable
1908
2012
  }], ctorParameters: () => [] });
1909
2013
 
@@ -2116,6 +2220,10 @@ class GanttBarDrag {
2116
2220
  dragRef.withBoundaryElement(this.dom.mainItems);
2117
2221
  dragRef.started.subscribe(() => {
2118
2222
  this.setDraggingStyles();
2223
+ dragRef.data = {
2224
+ start: this.item().start,
2225
+ end: this.item().end
2226
+ };
2119
2227
  this.containerScrollLeft = this.dom.mainContainer.scrollLeft;
2120
2228
  this.createDragScrollEvent(dragRef).subscribe(() => {
2121
2229
  if (dragRef.isDragging()) {
@@ -2138,6 +2246,7 @@ class GanttBarDrag {
2138
2246
  this.clearDraggingStyles();
2139
2247
  this.closeDragBackdrop();
2140
2248
  event.source.reset();
2249
+ event.source.data = null;
2141
2250
  this.stopScrolling();
2142
2251
  this.dragScrolling = false;
2143
2252
  this.dragScrollDistance = 0;
@@ -2306,25 +2415,28 @@ class GanttBarDrag {
2306
2415
  this.barElement.classList.remove('gantt-bar-draggable-drag');
2307
2416
  }
2308
2417
  barDragMove() {
2418
+ const { start: originStart, end: originEnd } = this.barDragRef.data;
2419
+ // 获取原始开始和结束日期在当前可见时间轴上的索引差值,用于计算新的结束日期
2420
+ const indexOffset = this.ganttUpper.view.getVisibleDateIndexOffset(originStart, originEnd);
2309
2421
  const currentX = this.item().refs.x + this.barDragMoveDistance + this.dragScrollDistance;
2310
2422
  const currentDate = this.ganttUpper.view.getDateByXPoint(currentX);
2311
2423
  const currentStartX = this.ganttUpper.view.getXPointByDate(currentDate);
2312
- const diffs = this.ganttUpper.view.differenceByPrecisionUnit(this.item().end, this.item().start);
2313
2424
  let start = currentDate;
2314
- let end = currentDate.add(diffs, this.ganttUpper.view?.options?.datePrecisionUnit);
2425
+ // 根据索引差值计算新的结束日期
2426
+ let end = this.ganttUpper.view.getDateByIndexOffset(currentDate, indexOffset);
2315
2427
  // 日视图特殊逻辑处理
2316
2428
  if (this.ganttUpper.view.viewType === GanttViewType.day) {
2317
2429
  const dayWidth = this.ganttUpper.view.getDayOccupancyWidth(currentDate);
2318
2430
  if (currentX > currentStartX + dayWidth / 2) {
2319
- start = start.addDays(1);
2320
- end = end.addDays(1);
2431
+ start = this.ganttUpper.view.getDateByIndexOffset(start, 1);
2432
+ end = this.ganttUpper.view.getDateByIndexOffset(end, 1);
2321
2433
  }
2322
2434
  }
2323
2435
  if (this.dragScrolling) {
2324
2436
  const left = currentX - this.barDragMoveDistance;
2325
2437
  this.barElement.style.left = left + 'px';
2326
2438
  }
2327
- this.openDragBackdrop(this.barElement, this.ganttUpper.view.getDateByXPoint(currentX), this.ganttUpper.view.getDateByXPoint(currentX + this.item().refs.width));
2439
+ this.openDragBackdrop(this.barElement, start, end);
2328
2440
  if (!this.isStartOrEndInsideView(start, end)) {
2329
2441
  return;
2330
2442
  }
@@ -2334,7 +2446,7 @@ class GanttBarDrag {
2334
2446
  barBeforeHandleDragMove() {
2335
2447
  const { x, start, minRangeWidthWidth } = this.startOfBarHandle();
2336
2448
  const width = this.item().refs.width + this.barHandleDragMoveAndScrollDistance * -1;
2337
- const diffs = this.ganttUpper.view.differenceByPrecisionUnit(this.item().end, start);
2449
+ const diffs = this.ganttUpper.view.getVisibleDateIndexOffset(start, this.item().end);
2338
2450
  if (width > dragMinWidth && diffs > 0) {
2339
2451
  this.barElement.style.width = width + 'px';
2340
2452
  this.barElement.style.left = x + 'px';
@@ -2358,8 +2470,8 @@ class GanttBarDrag {
2358
2470
  }
2359
2471
  barAfterHandleDragMove() {
2360
2472
  const { width, end } = this.endOfBarHandle();
2361
- const diffs = this.ganttUpper.view.differenceByPrecisionUnit(end, this.item().start);
2362
- if (width > dragMinWidth && diffs > 0) {
2473
+ const offset = this.ganttUpper.view.getVisibleDateIndexOffset(this.item().start, end);
2474
+ if (width > dragMinWidth && offset > 0) {
2363
2475
  this.barElement.style.width = width + 'px';
2364
2476
  this.openDragBackdrop(this.barElement, this.item().start, end);
2365
2477
  if (!this.isStartOrEndInsideView(this.item().start, end)) {
@@ -2368,14 +2480,14 @@ class GanttBarDrag {
2368
2480
  this.updateItemDate(this.item().start, end);
2369
2481
  }
2370
2482
  else {
2371
- if (this.barHandleDragMoveRecordDiffs > 0 && diffs <= 0) {
2483
+ if (this.barHandleDragMoveRecordDiffs > 0 && offset <= 0) {
2372
2484
  const minRangeWidth = this.ganttUpper.view.getMinRangeWidthByPrecisionUnit(this.item().start);
2373
2485
  this.barElement.style.width = minRangeWidth + 'px';
2374
2486
  }
2375
2487
  this.openDragBackdrop(this.barElement, this.item().start, this.item().start);
2376
2488
  this.updateItemDate(this.item().start, this.item().start);
2377
2489
  }
2378
- this.barHandleDragMoveRecordDiffs = diffs;
2490
+ this.barHandleDragMoveRecordDiffs = offset;
2379
2491
  this.dragContainer.dragMoved.emit({ item: this.item().origin });
2380
2492
  }
2381
2493
  calcLinkLinePositions(target, isBefore) {
@@ -2513,97 +2625,31 @@ class GanttBarDrag {
2513
2625
  this.linkDragRefs = this.createLinkHandleDrags();
2514
2626
  }
2515
2627
  }
2516
- createDrags() {
2517
- this.createMouseEvents();
2518
- this.createBarDragRef();
2519
- this.createBarHandleDragRefs();
2520
- this.createLinkDragRefs();
2521
- }
2522
- updateItem(item) {
2523
- this.item.set(item);
2524
- }
2525
- ngOnDestroy() {
2526
- this.closeDragBackdrop();
2527
- this.barDragRef?.dispose();
2528
- this.linkDragRefs?.forEach((dragRef) => dragRef.dispose());
2529
- this.barHandleDragRefs?.forEach((dragRef) => dragRef.dispose());
2530
- this.destroy$.next();
2531
- this.destroy$.complete();
2532
- this.stopScrolling();
2533
- this.stopScrollTimers$.complete();
2534
- }
2535
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttBarDrag, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2536
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttBarDrag }); }
2537
- }
2538
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttBarDrag, decorators: [{
2539
- type: Injectable
2540
- }], ctorParameters: () => [] });
2541
-
2542
- const sideWidth = 400;
2543
- const sideMiddleWidth = 500;
2544
- const sideMaxWidth = 600;
2545
- const sideMinWidth = 400;
2546
- const barBackground = '#6698ff';
2547
- const rangeHeight = 17;
2548
- const todayHeight = 24;
2549
- const todayWidth = 35;
2550
- const todayBorderRadius = 4;
2551
-
2552
- class GanttItemUpper {
2553
- constructor() {
2554
- this.elementRef = inject(ElementRef);
2555
- this.ganttUpper = inject(GANTT_UPPER_TOKEN);
2556
- this.firstChange = true;
2557
- this.unsubscribe$ = new Subject();
2558
- this.refsUnsubscribe$ = new Subject();
2559
- }
2560
- ngOnInit() {
2561
- this.firstChange = false;
2562
- this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
2563
- this.setPositions();
2564
- });
2565
- }
2566
- ngOnChanges(changes) {
2567
- if (!this.firstChange) {
2568
- this.itemChange(changes.item.currentValue);
2569
- }
2570
- }
2571
- itemChange(item) {
2572
- this.refsUnsubscribe$.next();
2573
- this.refsUnsubscribe$.complete();
2574
- this.item = item;
2575
- this.item.refs$.pipe(takeUntil(this.refsUnsubscribe$)).subscribe(() => {
2576
- this.setPositions();
2577
- });
2578
- }
2579
- setPositions() {
2580
- const itemElement = this.elementRef.nativeElement;
2581
- itemElement.style.left = this.item.refs?.x + 'px';
2582
- itemElement.style.top = this.item.refs?.y + 'px';
2583
- itemElement.style.width = this.item.refs?.width + 'px';
2584
- if (this.item.type === GanttItemType.bar) {
2585
- itemElement.style.height = this.ganttUpper.styles.barHeight + 'px';
2586
- }
2587
- else if (this.item.type === GanttItemType.range) {
2588
- itemElement.style.height = rangeHeight + 'px';
2589
- }
2590
- }
2628
+ createDrags() {
2629
+ this.createMouseEvents();
2630
+ this.createBarDragRef();
2631
+ this.createBarHandleDragRefs();
2632
+ this.createLinkDragRefs();
2633
+ }
2634
+ updateItem(item) {
2635
+ this.item.set(item);
2636
+ }
2591
2637
  ngOnDestroy() {
2592
- this.unsubscribe$.next();
2593
- this.unsubscribe$.complete();
2594
- this.refsUnsubscribe$.next();
2595
- this.refsUnsubscribe$.complete();
2638
+ this.closeDragBackdrop();
2639
+ this.barDragRef?.dispose();
2640
+ this.linkDragRefs?.forEach((dragRef) => dragRef.dispose());
2641
+ this.barHandleDragRefs?.forEach((dragRef) => dragRef.dispose());
2642
+ this.destroy$.next();
2643
+ this.destroy$.complete();
2644
+ this.stopScrolling();
2645
+ this.stopScrollTimers$.complete();
2596
2646
  }
2597
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttItemUpper, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2598
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.10", type: GanttItemUpper, isStandalone: true, inputs: { template: "template", item: "item" }, usesOnChanges: true, ngImport: i0 }); }
2647
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttBarDrag, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2648
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttBarDrag }); }
2599
2649
  }
2600
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttItemUpper, decorators: [{
2601
- type: Directive
2602
- }], ctorParameters: () => [], propDecorators: { template: [{
2603
- type: Input
2604
- }], item: [{
2605
- type: Input
2606
- }] } });
2650
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttBarDrag, decorators: [{
2651
+ type: Injectable
2652
+ }], ctorParameters: () => [] });
2607
2653
 
2608
2654
  function linearGradient(sideOrCorner, color, stop) {
2609
2655
  return `linear-gradient(${sideOrCorner},${color} 0%,${stop} 40%)`;
@@ -2665,11 +2711,11 @@ class NgxGanttBarComponent extends GanttItemUpper {
2665
2711
  this.barClick.emit({ event, item: this.item.origin });
2666
2712
  }
2667
2713
  setContentBackground() {
2714
+ let style = { ...(this.item.barStyle || {}) };
2715
+ const contentElement = this.contentElementRef.nativeElement;
2716
+ const barElement = this.elementRef.nativeElement;
2668
2717
  if (this.item.refs?.width) {
2669
- const contentElement = this.contentElementRef.nativeElement;
2670
2718
  const color = this.item.color || barBackground;
2671
- const style = this.item.barStyle || {};
2672
- const barElement = this.elementRef.nativeElement;
2673
2719
  if (this.item.origin.start && this.item.origin.end) {
2674
2720
  style.background = color;
2675
2721
  style.borderRadius = '';
@@ -2689,13 +2735,13 @@ class NgxGanttBarComponent extends GanttItemUpper {
2689
2735
  if (this.item.progress >= 0) {
2690
2736
  const contentProgressElement = contentElement.querySelector('.gantt-bar-content-progress');
2691
2737
  style.background = hexToRgb(color, 0.3);
2692
- style.borderRadius = '';
2693
2738
  contentProgressElement.style.background = color;
2694
2739
  }
2695
- for (const key in style) {
2696
- if (style.hasOwnProperty(key)) {
2697
- contentElement.style[key] = style[key];
2698
- }
2740
+ }
2741
+ style = Object.assign({}, style, this.item.barStyle || {});
2742
+ for (const key in style) {
2743
+ if (style.hasOwnProperty(key)) {
2744
+ contentElement.style[key] = style[key];
2699
2745
  }
2700
2746
  }
2701
2747
  }
@@ -2798,11 +2844,11 @@ class GanttCalendarGridComponent {
2798
2844
  this.unsubscribe$.complete();
2799
2845
  }
2800
2846
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttCalendarGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2801
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.10", 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" }); }
2847
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.10", 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" }); }
2802
2848
  }
2803
2849
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttCalendarGridComponent, decorators: [{
2804
2850
  type: Component,
2805
- 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" }]
2851
+ 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" }]
2806
2852
  }], ctorParameters: () => [], propDecorators: { className: [{
2807
2853
  type: HostBinding,
2808
2854
  args: ['class']
@@ -2817,193 +2863,402 @@ class GanttCalendarHeaderComponent {
2817
2863
  }
2818
2864
  constructor() {
2819
2865
  this.ganttUpper = inject(GANTT_UPPER_TOKEN);
2820
- this.ngZone = inject(NgZone);
2821
- this.elementRef = inject(ElementRef);
2822
- this.unsubscribe$ = new Subject();
2823
- this.viewTypes = GanttViewType;
2824
- this.className = `gantt-calendar gantt-calendar-header`;
2825
- }
2826
- ngOnInit() {
2827
- // 头部日期定位
2828
- this.ngZone.onStable.pipe(take(1)).subscribe(() => {
2829
- merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
2830
- .pipe(takeUntil(this.unsubscribe$))
2831
- .subscribe(() => {
2832
- if (this.ganttUpper.viewType === GanttViewType.day)
2833
- this.setTodayPoint();
2834
- });
2835
- });
2866
+ this.ngZone = inject(NgZone);
2867
+ this.elementRef = inject(ElementRef);
2868
+ this.unsubscribe$ = new Subject();
2869
+ this.viewTypes = GanttViewType;
2870
+ this.className = `gantt-calendar gantt-calendar-header`;
2871
+ }
2872
+ ngOnInit() {
2873
+ // 头部日期定位
2874
+ this.ngZone.onStable.pipe(take(1)).subscribe(() => {
2875
+ merge(this.ganttUpper.viewChange, this.ganttUpper.view.start$)
2876
+ .pipe(takeUntil(this.unsubscribe$))
2877
+ .subscribe(() => {
2878
+ if (this.ganttUpper.viewType === GanttViewType.day)
2879
+ this.setTodayPoint();
2880
+ });
2881
+ });
2882
+ }
2883
+ setTodayPoint() {
2884
+ const x = this.view.getTodayXPoint();
2885
+ const today = new GanttDate().getDate();
2886
+ const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
2887
+ const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
2888
+ if (isNumber(x)) {
2889
+ if (rect) {
2890
+ rect.style.left = `${x - todayWidth / 2}px`;
2891
+ rect.style.top = `${this.ganttUpper.styles.headerHeight - todayHeight}px`;
2892
+ rect.innerHTML = today.toString();
2893
+ }
2894
+ }
2895
+ else {
2896
+ todayEle.style.display = 'none';
2897
+ }
2898
+ }
2899
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttCalendarHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2900
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.10", 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"] }] }); }
2901
+ }
2902
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
2903
+ type: Component,
2904
+ 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" }]
2905
+ }], ctorParameters: () => [], propDecorators: { className: [{
2906
+ type: HostBinding,
2907
+ args: ['class']
2908
+ }], height: [{
2909
+ type: HostBinding,
2910
+ args: ['style.height']
2911
+ }] } });
2912
+
2913
+ class GanttDragBackdropComponent {
2914
+ constructor() {
2915
+ this.ganttUpper = inject(GANTT_UPPER_TOKEN);
2916
+ }
2917
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2918
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", 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" }); }
2919
+ }
2920
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
2921
+ type: Component,
2922
+ args: [{ selector: 'gantt-drag-backdrop', host: {
2923
+ class: 'gantt-drag-backdrop'
2924
+ }, 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" }]
2925
+ }], ctorParameters: () => [] });
2926
+
2927
+ class GanttLoaderComponent {
2928
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2929
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: GanttLoaderComponent, isStandalone: true, selector: "gantt-loader", host: { classAttribute: "gantt-loader gantt-loader-overlay" }, ngImport: i0, template: `
2930
+ <div class="gantt-loader-wrapper">
2931
+ <div class="gantt-loader-loading">
2932
+ <span class="gantt-loader-loading-spot"></span>
2933
+ </div>
2934
+ </div>
2935
+ `, isInline: true }); }
2936
+ }
2937
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttLoaderComponent, decorators: [{
2938
+ type: Component,
2939
+ args: [{
2940
+ selector: 'gantt-loader',
2941
+ template: `
2942
+ <div class="gantt-loader-wrapper">
2943
+ <div class="gantt-loader-loading">
2944
+ <span class="gantt-loader-loading-spot"></span>
2945
+ </div>
2946
+ </div>
2947
+ `,
2948
+ host: {
2949
+ class: 'gantt-loader gantt-loader-overlay'
2950
+ },
2951
+ standalone: true
2952
+ }]
2953
+ }] });
2954
+
2955
+ class NgxGanttRangeComponent extends GanttItemUpper {
2956
+ constructor() {
2957
+ super();
2958
+ this.ganttRangeClass = true;
2959
+ }
2960
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: NgxGanttRangeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2961
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.10", 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"] }] }); }
2962
+ }
2963
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
2964
+ type: Component,
2965
+ 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" }]
2966
+ }], ctorParameters: () => [], propDecorators: { ganttRangeClass: [{
2967
+ type: HostBinding,
2968
+ args: ['class.gantt-range']
2969
+ }] } });
2970
+
2971
+ class GanttSyncScrollService {
2972
+ constructor() {
2973
+ this.ngZone = inject(NgZone);
2974
+ this.scrollGroupsMap = new Map();
2975
+ }
2976
+ registerScrollEvent(groupName, element, direction) {
2977
+ const group = this.scrollGroupsMap.get(groupName) || { elements: [], destroy$: new Subject(), direction };
2978
+ group.elements.push(element);
2979
+ this.scrollGroupsMap.set(groupName, group);
2980
+ this.monitorScrollChange(group);
2981
+ }
2982
+ unregisterScrollEvent(groupName, element) {
2983
+ const group = this.scrollGroupsMap.get(groupName);
2984
+ if (group) {
2985
+ group.elements = group.elements.filter((el) => el !== element);
2986
+ if (!group.elements.length) {
2987
+ this.scrollGroupsMap.delete(groupName);
2988
+ }
2989
+ else {
2990
+ this.scrollGroupsMap.set(groupName, group);
2991
+ }
2992
+ this.monitorScrollChange(group);
2993
+ }
2994
+ }
2995
+ monitorScrollChange(group) {
2996
+ const { elements, destroy$, direction } = group;
2997
+ destroy$.next();
2998
+ destroy$.complete();
2999
+ if (elements.length) {
3000
+ const scrollObservers = elements.map((el) => fromEvent(el, 'scroll', passiveListenerOptions));
3001
+ this.ngZone.runOutsideAngular(() => merge(...scrollObservers)
3002
+ .pipe(takeUntil$1(destroy$))
3003
+ .subscribe((event) => {
3004
+ elements.forEach((el) => {
3005
+ if (direction === 'x') {
3006
+ el.scrollLeft = event.currentTarget.scrollLeft;
3007
+ }
3008
+ else {
3009
+ el.scrollTop = event.currentTarget.scrollTop;
3010
+ }
3011
+ });
3012
+ }));
3013
+ }
3014
+ }
3015
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3016
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollService }); }
3017
+ }
3018
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollService, decorators: [{
3019
+ type: Injectable
3020
+ }], ctorParameters: () => [] });
3021
+
3022
+ class GanttSyncScrollXDirective {
3023
+ constructor() {
3024
+ this.syncScrollX = input(...(ngDevMode ? [undefined, { debugName: "syncScrollX" }] : []));
3025
+ this.elementRef = inject((ElementRef));
3026
+ this.syncScrollService = inject(GanttSyncScrollService);
3027
+ }
3028
+ ngOnInit() {
3029
+ this.syncScrollService.registerScrollEvent(this.syncScrollX(), this.elementRef.nativeElement, 'x');
3030
+ }
3031
+ ngOnDestroy() {
3032
+ this.syncScrollService.unregisterScrollEvent(this.syncScrollX(), this.elementRef.nativeElement);
3033
+ }
3034
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollXDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3035
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.10", type: GanttSyncScrollXDirective, isStandalone: true, selector: "[syncScrollX]", inputs: { syncScrollX: { classPropertyName: "syncScrollX", publicName: "syncScrollX", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
3036
+ }
3037
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollXDirective, decorators: [{
3038
+ type: Directive,
3039
+ args: [{
3040
+ selector: '[syncScrollX]',
3041
+ standalone: true
3042
+ }]
3043
+ }], ctorParameters: () => [], propDecorators: { syncScrollX: [{ type: i0.Input, args: [{ isSignal: true, alias: "syncScrollX", required: false }] }] } });
3044
+ class GanttSyncScrollYDirective {
3045
+ constructor() {
3046
+ this.syncScrollY = input(...(ngDevMode ? [undefined, { debugName: "syncScrollY" }] : []));
3047
+ this.syncScrollService = inject(GanttSyncScrollService);
3048
+ this.elementRef = inject((ElementRef));
3049
+ }
3050
+ ngOnInit() {
3051
+ this.syncScrollService.registerScrollEvent(this.syncScrollY(), this.elementRef.nativeElement, 'y');
3052
+ }
3053
+ ngOnDestroy() {
3054
+ this.syncScrollService.unregisterScrollEvent(this.syncScrollY(), this.elementRef.nativeElement);
3055
+ }
3056
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollYDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3057
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.10", type: GanttSyncScrollYDirective, isStandalone: true, selector: "[syncScrollY]", inputs: { syncScrollY: { classPropertyName: "syncScrollY", publicName: "syncScrollY", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
3058
+ }
3059
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollYDirective, decorators: [{
3060
+ type: Directive,
3061
+ args: [{
3062
+ selector: '[syncScrollY]',
3063
+ standalone: true
3064
+ }]
3065
+ }], ctorParameters: () => [], propDecorators: { syncScrollY: [{ type: i0.Input, args: [{ isSignal: true, alias: "syncScrollY", required: false }] }] } });
3066
+
3067
+ class GanttScrollbarComponent {
3068
+ constructor() {
3069
+ this.ganttUpper = inject(GANTT_UPPER_TOKEN);
3070
+ this.hasFooter = input(false, ...(ngDevMode ? [{ debugName: "hasFooter" }] : []));
3071
+ this.tableWidth = input(...(ngDevMode ? [undefined, { debugName: "tableWidth" }] : []));
3072
+ this.ganttRoot = input(...(ngDevMode ? [undefined, { debugName: "ganttRoot" }] : []));
3073
+ this.tableScrollWidth = input(0, ...(ngDevMode ? [{ debugName: "tableScrollWidth" }] : []));
3074
+ }
3075
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttScrollbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3076
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.10", 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"] }] }); }
3077
+ }
3078
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttScrollbarComponent, decorators: [{
3079
+ type: Component,
3080
+ 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" }]
3081
+ }], ctorParameters: () => [], propDecorators: { hasFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasFooter", required: false }] }], tableWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableWidth", required: false }] }], ganttRoot: [{ type: i0.Input, args: [{ isSignal: true, alias: "ganttRoot", required: false }] }], tableScrollWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableScrollWidth", required: false }] }] } });
3082
+
3083
+ class NgxGanttToolbarComponent {
3084
+ get top() {
3085
+ return this.ganttUpper.styles.headerHeight + 16 + 'px';
3086
+ }
3087
+ constructor() {
3088
+ this.ganttUpper = inject(GANTT_UPPER_TOKEN);
3089
+ this.ganttItemClass = true;
3090
+ this.views = inject(GanttConfigService).getViewsLocale();
2836
3091
  }
2837
- setTodayPoint() {
2838
- const x = this.view.getTodayXPoint();
2839
- const today = new GanttDate().getDate();
2840
- const todayEle = this.elementRef.nativeElement.getElementsByClassName('gantt-calendar-today-overlay')[0];
2841
- const rect = this.elementRef.nativeElement.getElementsByClassName('today-rect')[0];
2842
- if (isNumber(x)) {
2843
- if (rect) {
2844
- rect.style.left = `${x - todayWidth / 2}px`;
2845
- rect.style.top = `${this.ganttUpper.styles.headerHeight - todayHeight}px`;
2846
- rect.innerHTML = today.toString();
2847
- }
2848
- }
2849
- else {
2850
- todayEle.style.display = 'none';
2851
- }
3092
+ selectView(view) {
3093
+ this.ganttUpper.changeView(view);
2852
3094
  }
2853
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttCalendarHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2854
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.10", 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"] }] }); }
3095
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: NgxGanttToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3096
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.10", 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"] }] }); }
2855
3097
  }
2856
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttCalendarHeaderComponent, decorators: [{
3098
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
2857
3099
  type: Component,
2858
- 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" }]
2859
- }], ctorParameters: () => [], propDecorators: { className: [{
3100
+ 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" }]
3101
+ }], ctorParameters: () => [], propDecorators: { template: [{
3102
+ type: Input
3103
+ }], ganttItemClass: [{
2860
3104
  type: HostBinding,
2861
- args: ['class']
2862
- }], height: [{
3105
+ args: ['class.gantt-toolbar']
3106
+ }], top: [{
2863
3107
  type: HostBinding,
2864
- args: ['style.height']
3108
+ args: ['style.top']
2865
3109
  }] } });
2866
3110
 
2867
- class GanttDragBackdropComponent {
2868
- constructor() {
2869
- this.ganttUpper = inject(GANTT_UPPER_TOKEN);
3111
+ class GanttPrintService {
3112
+ constructor() { }
3113
+ setInlineStyles(targetElem) {
3114
+ const svgElements = Array.from(targetElem.getElementsByTagName('svg'));
3115
+ for (const svgElement of svgElements) {
3116
+ this.recursElementChildren(svgElement);
3117
+ }
2870
3118
  }
2871
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDragBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2872
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", 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" }); }
3119
+ recursElementChildren(node) {
3120
+ const transformProperties = [
3121
+ 'fill',
3122
+ 'color',
3123
+ 'font-size',
3124
+ 'stroke',
3125
+ 'font',
3126
+ 'text-anchor',
3127
+ 'stroke-dasharray',
3128
+ 'shape-rendering',
3129
+ 'stroke-width'
3130
+ ];
3131
+ if (!node.style) {
3132
+ return;
3133
+ }
3134
+ const styles = getComputedStyle(node);
3135
+ for (const transformProperty of transformProperties) {
3136
+ node.style[transformProperty] = styles[transformProperty];
3137
+ }
3138
+ for (const child of Array.from(node.childNodes)) {
3139
+ this.recursElementChildren(child);
3140
+ }
3141
+ }
3142
+ register(root) {
3143
+ this.root = root.nativeElement;
3144
+ this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
3145
+ }
3146
+ async html2canvas(ignoreElementClass) {
3147
+ const root = this.root;
3148
+ const mainContainer = this.mainContainer;
3149
+ // set print width
3150
+ const printWidth = root.offsetWidth;
3151
+ // set print height
3152
+ const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
3153
+ const html2canvas = (await import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')).default;
3154
+ return html2canvas(root, {
3155
+ logging: false,
3156
+ allowTaint: true,
3157
+ useCORS: true,
3158
+ width: printWidth,
3159
+ height: printHeight,
3160
+ ignoreElements: (element) => {
3161
+ if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
3162
+ return true;
3163
+ }
3164
+ if (element.classList.contains('gantt-calendar-today-overlay')) {
3165
+ return true;
3166
+ }
3167
+ },
3168
+ onclone: (cloneDocument) => {
3169
+ const ganttClass = root.className;
3170
+ const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
3171
+ const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
3172
+ const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-grid-main');
3173
+ const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
3174
+ // change targetDom width
3175
+ cloneGanttDom.style.width = `${printWidth}px`;
3176
+ cloneGanttDom.style.height = `${printHeight}px`;
3177
+ cloneGanttDom.style.overflow = `unset`;
3178
+ cloneGanttContainerDom.style.backgroundColor = '#fff';
3179
+ cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
3180
+ cloneCalendarOverlay.setAttribute('style', `background: transparent`);
3181
+ if (cloneLinksOverlay) {
3182
+ cloneLinksOverlay.setAttribute('height', `${printHeight}`);
3183
+ cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
3184
+ }
3185
+ // setInlineStyles for svg
3186
+ this.setInlineStyles(cloneGanttDom);
3187
+ }
3188
+ });
3189
+ }
3190
+ async print(name = 'download', ignoreElementClass) {
3191
+ this.html2canvas(ignoreElementClass).then((canvas) => {
3192
+ const link = document.createElement('a');
3193
+ const dataUrl = canvas.toDataURL('image/png');
3194
+ link.download = `${name}.png`;
3195
+ link.href = dataUrl;
3196
+ link.click();
3197
+ });
3198
+ }
3199
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3200
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttPrintService }); }
2873
3201
  }
2874
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttDragBackdropComponent, decorators: [{
2875
- type: Component,
2876
- args: [{ selector: 'gantt-drag-backdrop', host: {
2877
- class: 'gantt-drag-backdrop'
2878
- }, 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" }]
3202
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttPrintService, decorators: [{
3203
+ type: Injectable
2879
3204
  }], ctorParameters: () => [] });
2880
3205
 
2881
- 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>`;
2882
- 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>`;
2883
- 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>`;
2884
- 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>`;
2885
- 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">
2886
- <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)">
2887
- <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform>
2888
- </path>
2889
- </svg>`;
2890
- const emptyIcon = `<svg
2891
- width="148px"
2892
- height="134px"
2893
- viewBox="0 0 148 134"
2894
- version="1.1"
2895
- xmlns="http://www.w3.org/2000/svg"
2896
- xmlns:xlink="http://www.w3.org/1999/xlink"
2897
- >
2898
- <defs>
2899
- <filter x="0.0%" y="0.0%" width="100.0%" height="100.0%" filterUnits="objectBoundingBox" id="filter-1">
2900
- <feGaussianBlur stdDeviation="0" in="SourceGraphic"></feGaussianBlur>
2901
- </filter>
2902
- </defs>
2903
- <g id="148x134" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
2904
- <g id="编组-6" transform="translate(1.000000, 1.000000)">
2905
- <ellipse
2906
- id="椭圆形"
2907
- fill="#EDEEF2"
2908
- opacity="0.3"
2909
- filter="url(#filter-1)"
2910
- cx="73.0800017"
2911
- cy="115.920003"
2912
- rx="73.0800017"
2913
- ry="16.8000004"
2914
- ></ellipse>
2915
- <g id="编组-5" transform="translate(15.120000, 0.000000)">
2916
- <polygon
2917
- id="矩形"
2918
- fill="#E2E4E9"
2919
- points="19.2789848 49.5600011 99.1200023 48.7200011 117.600003 75.9297673 117.600003 92.313049 0 92.313049 0 75.0356267"
2920
- ></polygon>
2921
- <path
2922
- 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"
2923
- id="矩形"
2924
- fill="#F9FAFB"
2925
- ></path>
2926
- <path
2927
- 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"
2928
- id="矩形"
2929
- fill="#E8EAEE"
2930
- ></path>
2931
- <text
2932
- id="&lt;/null&gt;"
2933
- font-family="PingFangSC-Medium, PingFang SC"
2934
- font-size="15.1200003"
2935
- font-weight="400"
2936
- fill="#BCBECD"
2937
- >
2938
- <tspan x="33.6000008" y="32.8000004">&lt;/null&gt;</tspan>
2939
- </text>
2940
- <rect id="矩形" fill="#E8EAEE" x="27.5600006" y="52.0800012" width="61.4800014" height="5.04000011" rx="2.52000006"></rect>
2941
- <rect
2942
- id="矩形备份"
2943
- fill="#E8EAEE"
2944
- x="27.5600006"
2945
- y="63.8400014"
2946
- width="61.4800014"
2947
- height="5.04000011"
2948
- rx="2.52000006"
2949
- ></rect>
2950
- <path
2951
- 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"
2952
- id="矩形"
2953
- fill="#EDEFF2"
2954
- ></path>
2955
- </g>
2956
- </g>
2957
- </g>
2958
- </svg>`;
2959
- 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>`;
2960
- 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>`;
2961
- 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>`;
2962
- const icons = {
2963
- 'angle-right': angleRight,
2964
- 'angle-down': angleDown,
2965
- 'plus-square': plusSquare,
2966
- 'minus-square': minusSquare,
2967
- loading: loadingIcon,
2968
- empty: emptyIcon,
2969
- drag: dragIcon,
2970
- 'arrow-left': arrowLeftIcon,
2971
- 'arrow-right': arrowRightIcon
2972
- };
2973
-
2974
- class GanttIconComponent {
2975
- set iconName(name) {
2976
- this.setSvg(name);
3206
+ class IsGanttRangeItemPipe {
3207
+ transform(value) {
3208
+ return value === GanttItemType.range;
3209
+ }
3210
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3211
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.10", ngImport: i0, type: IsGanttRangeItemPipe, isStandalone: true, name: "isGanttRangeItem" }); }
3212
+ }
3213
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
3214
+ type: Pipe,
3215
+ args: [{
3216
+ name: 'isGanttRangeItem',
3217
+ standalone: true
3218
+ }]
3219
+ }] });
3220
+ class IsGanttBarItemPipe {
3221
+ transform(value) {
3222
+ return value === GanttItemType.bar;
2977
3223
  }
2978
- constructor() {
2979
- this.elementRef = inject(ElementRef);
2980
- this.isIcon = true;
3224
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3225
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.10", ngImport: i0, type: IsGanttBarItemPipe, isStandalone: true, name: "isGanttBarItem" }); }
3226
+ }
3227
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
3228
+ type: Pipe,
3229
+ args: [{
3230
+ name: 'isGanttBarItem',
3231
+ standalone: true
3232
+ }]
3233
+ }] });
3234
+ class IsGanttCustomItemPipe {
3235
+ transform(value) {
3236
+ return value === GanttItemType.custom;
2981
3237
  }
2982
- setSvg(name) {
2983
- const iconSvg = icons[name];
2984
- if (iconSvg) {
2985
- this.elementRef.nativeElement.innerHTML = iconSvg;
2986
- }
2987
- else {
2988
- this.elementRef.nativeElement.innerHTML = '';
2989
- }
3238
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3239
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.10", ngImport: i0, type: IsGanttCustomItemPipe, isStandalone: true, name: "isGanttCustomItem" }); }
3240
+ }
3241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
3242
+ type: Pipe,
3243
+ args: [{
3244
+ name: 'isGanttCustomItem',
3245
+ standalone: true
3246
+ }]
3247
+ }] });
3248
+ class IsGanttGroupPipe {
3249
+ transform(data) {
3250
+ return !!data.items;
2990
3251
  }
2991
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2992
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: GanttIconComponent, isStandalone: true, selector: "gantt-icon", inputs: { iconName: "iconName" }, host: { properties: { "class.gantt-icon": "this.isIcon" } }, ngImport: i0, template: '', isInline: true }); }
3252
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttGroupPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3253
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.10", ngImport: i0, type: IsGanttGroupPipe, isStandalone: true, name: "isGanttGroup" }); }
2993
3254
  }
2994
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttIconComponent, decorators: [{
2995
- type: Component,
3255
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttGroupPipe, decorators: [{
3256
+ type: Pipe,
2996
3257
  args: [{
2997
- selector: 'gantt-icon',
2998
- template: '',
3258
+ name: 'isGanttGroup',
2999
3259
  standalone: true
3000
3260
  }]
3001
- }], ctorParameters: () => [], propDecorators: { isIcon: [{
3002
- type: HostBinding,
3003
- args: ['class.gantt-icon']
3004
- }], iconName: [{
3005
- type: Input
3006
- }] } });
3261
+ }] });
3007
3262
 
3008
3263
  class GanttLinkLine {
3009
3264
  constructor() { }
@@ -3273,7 +3528,7 @@ class GanttLinksComponent {
3273
3528
  this.flatItems.forEach((item, itemIndex) => {
3274
3529
  if (!item.hasOwnProperty('items')) {
3275
3530
  const ganttItem = item;
3276
- if (ganttItem.refs) {
3531
+ if (ganttItem.refs && ganttItem.refs.width > 0) {
3277
3532
  const y = itemIndex * lineHeight + ganttItem.refs.y + barHeight / 2;
3278
3533
  this.linkItems.push({
3279
3534
  ...ganttItem,
@@ -3379,105 +3634,131 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
3379
3634
  args: ['class.gantt-links-overlay']
3380
3635
  }] } });
3381
3636
 
3382
- class GanttLoaderComponent {
3383
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3384
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: GanttLoaderComponent, isStandalone: true, selector: "gantt-loader", host: { classAttribute: "gantt-loader gantt-loader-overlay" }, ngImport: i0, template: `
3385
- <div class="gantt-loader-wrapper">
3386
- <div class="gantt-loader-loading">
3387
- <span class="gantt-loader-loading-spot"></span>
3388
- </div>
3389
- </div>
3390
- `, isInline: true }); }
3391
- }
3392
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttLoaderComponent, decorators: [{
3393
- type: Component,
3394
- args: [{
3395
- selector: 'gantt-loader',
3396
- template: `
3397
- <div class="gantt-loader-wrapper">
3398
- <div class="gantt-loader-loading">
3399
- <span class="gantt-loader-loading-spot"></span>
3400
- </div>
3401
- </div>
3402
- `,
3403
- host: {
3404
- class: 'gantt-loader gantt-loader-overlay'
3405
- },
3406
- standalone: true
3407
- }]
3408
- }] });
3637
+ 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>`;
3638
+ 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>`;
3639
+ 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>`;
3640
+ 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>`;
3641
+ 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">
3642
+ <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)">
3643
+ <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform>
3644
+ </path>
3645
+ </svg>`;
3646
+ const emptyIcon = `<svg
3647
+ width="148px"
3648
+ height="134px"
3649
+ viewBox="0 0 148 134"
3650
+ version="1.1"
3651
+ xmlns="http://www.w3.org/2000/svg"
3652
+ xmlns:xlink="http://www.w3.org/1999/xlink"
3653
+ >
3654
+ <defs>
3655
+ <filter x="0.0%" y="0.0%" width="100.0%" height="100.0%" filterUnits="objectBoundingBox" id="filter-1">
3656
+ <feGaussianBlur stdDeviation="0" in="SourceGraphic"></feGaussianBlur>
3657
+ </filter>
3658
+ </defs>
3659
+ <g id="148x134" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
3660
+ <g id="编组-6" transform="translate(1.000000, 1.000000)">
3661
+ <ellipse
3662
+ id="椭圆形"
3663
+ fill="#EDEEF2"
3664
+ opacity="0.3"
3665
+ filter="url(#filter-1)"
3666
+ cx="73.0800017"
3667
+ cy="115.920003"
3668
+ rx="73.0800017"
3669
+ ry="16.8000004"
3670
+ ></ellipse>
3671
+ <g id="编组-5" transform="translate(15.120000, 0.000000)">
3672
+ <polygon
3673
+ id="矩形"
3674
+ fill="#E2E4E9"
3675
+ points="19.2789848 49.5600011 99.1200023 48.7200011 117.600003 75.9297673 117.600003 92.313049 0 92.313049 0 75.0356267"
3676
+ ></polygon>
3677
+ <path
3678
+ 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"
3679
+ id="矩形"
3680
+ fill="#F9FAFB"
3681
+ ></path>
3682
+ <path
3683
+ 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"
3684
+ id="矩形"
3685
+ fill="#E8EAEE"
3686
+ ></path>
3687
+ <text
3688
+ id="&lt;/null&gt;"
3689
+ font-family="PingFangSC-Medium, PingFang SC"
3690
+ font-size="15.1200003"
3691
+ font-weight="400"
3692
+ fill="#BCBECD"
3693
+ >
3694
+ <tspan x="33.6000008" y="32.8000004">&lt;/null&gt;</tspan>
3695
+ </text>
3696
+ <rect id="矩形" fill="#E8EAEE" x="27.5600006" y="52.0800012" width="61.4800014" height="5.04000011" rx="2.52000006"></rect>
3697
+ <rect
3698
+ id="矩形备份"
3699
+ fill="#E8EAEE"
3700
+ x="27.5600006"
3701
+ y="63.8400014"
3702
+ width="61.4800014"
3703
+ height="5.04000011"
3704
+ rx="2.52000006"
3705
+ ></rect>
3706
+ <path
3707
+ 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"
3708
+ id="矩形"
3709
+ fill="#EDEFF2"
3710
+ ></path>
3711
+ </g>
3712
+ </g>
3713
+ </g>
3714
+ </svg>`;
3715
+ 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>`;
3716
+ 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>`;
3717
+ 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>`;
3718
+ const icons = {
3719
+ 'angle-right': angleRight,
3720
+ 'angle-down': angleDown,
3721
+ 'plus-square': plusSquare,
3722
+ 'minus-square': minusSquare,
3723
+ loading: loadingIcon,
3724
+ empty: emptyIcon,
3725
+ drag: dragIcon,
3726
+ 'arrow-left': arrowLeftIcon,
3727
+ 'arrow-right': arrowRightIcon
3728
+ };
3409
3729
 
3410
- class IsGanttRangeItemPipe {
3411
- transform(value) {
3412
- return value === GanttItemType.range;
3413
- }
3414
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttRangeItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3415
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.10", ngImport: i0, type: IsGanttRangeItemPipe, isStandalone: true, name: "isGanttRangeItem" }); }
3416
- }
3417
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttRangeItemPipe, decorators: [{
3418
- type: Pipe,
3419
- args: [{
3420
- name: 'isGanttRangeItem',
3421
- standalone: true
3422
- }]
3423
- }] });
3424
- class IsGanttBarItemPipe {
3425
- transform(value) {
3426
- return value === GanttItemType.bar;
3427
- }
3428
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttBarItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3429
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.10", ngImport: i0, type: IsGanttBarItemPipe, isStandalone: true, name: "isGanttBarItem" }); }
3430
- }
3431
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttBarItemPipe, decorators: [{
3432
- type: Pipe,
3433
- args: [{
3434
- name: 'isGanttBarItem',
3435
- standalone: true
3436
- }]
3437
- }] });
3438
- class IsGanttCustomItemPipe {
3439
- transform(value) {
3440
- return value === GanttItemType.custom;
3441
- }
3442
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttCustomItemPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3443
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.10", ngImport: i0, type: IsGanttCustomItemPipe, isStandalone: true, name: "isGanttCustomItem" }); }
3444
- }
3445
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttCustomItemPipe, decorators: [{
3446
- type: Pipe,
3447
- args: [{
3448
- name: 'isGanttCustomItem',
3449
- standalone: true
3450
- }]
3451
- }] });
3452
- class IsGanttGroupPipe {
3453
- transform(data) {
3454
- return !!data.items;
3730
+ class GanttIconComponent {
3731
+ set iconName(name) {
3732
+ this.setSvg(name);
3455
3733
  }
3456
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttGroupPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3457
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.10", ngImport: i0, type: IsGanttGroupPipe, isStandalone: true, name: "isGanttGroup" }); }
3458
- }
3459
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: IsGanttGroupPipe, decorators: [{
3460
- type: Pipe,
3461
- args: [{
3462
- name: 'isGanttGroup',
3463
- standalone: true
3464
- }]
3465
- }] });
3466
-
3467
- class NgxGanttRangeComponent extends GanttItemUpper {
3468
3734
  constructor() {
3469
- super();
3470
- this.ganttRangeClass = true;
3735
+ this.elementRef = inject(ElementRef);
3736
+ this.isIcon = true;
3737
+ }
3738
+ setSvg(name) {
3739
+ const iconSvg = icons[name];
3740
+ if (iconSvg) {
3741
+ this.elementRef.nativeElement.innerHTML = iconSvg;
3742
+ }
3743
+ else {
3744
+ this.elementRef.nativeElement.innerHTML = '';
3745
+ }
3471
3746
  }
3472
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: NgxGanttRangeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3473
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.10", 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"] }] }); }
3747
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3748
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: GanttIconComponent, isStandalone: true, selector: "gantt-icon", inputs: { iconName: "iconName" }, host: { properties: { "class.gantt-icon": "this.isIcon" } }, ngImport: i0, template: '', isInline: true }); }
3474
3749
  }
3475
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: NgxGanttRangeComponent, decorators: [{
3750
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttIconComponent, decorators: [{
3476
3751
  type: Component,
3477
- 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" }]
3478
- }], ctorParameters: () => [], propDecorators: { ganttRangeClass: [{
3752
+ args: [{
3753
+ selector: 'gantt-icon',
3754
+ template: '',
3755
+ standalone: true
3756
+ }]
3757
+ }], ctorParameters: () => [], propDecorators: { isIcon: [{
3479
3758
  type: HostBinding,
3480
- args: ['class.gantt-range']
3759
+ args: ['class.gantt-icon']
3760
+ }], iconName: [{
3761
+ type: Input
3481
3762
  }] } });
3482
3763
 
3483
3764
  class GanttMainComponent {
@@ -3516,7 +3797,7 @@ class GanttMainComponent {
3516
3797
  this.ganttRoot.scrollToDate(date);
3517
3798
  }
3518
3799
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttMainComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3519
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.10", type: GanttMainComponent, isStandalone: true, selector: "gantt-main", inputs: { viewportItems: "viewportItems", flatItems: "flatItems", groupHeaderTemplate: "groupHeaderTemplate", itemTemplate: "itemTemplate", barTemplate: "barTemplate", rangeTemplate: "rangeTemplate", baselineTemplate: "baselineTemplate", ganttRoot: "ganttRoot", quickTimeFocus: "quickTimeFocus" }, outputs: { barClick: "barClick", lineClick: "lineClick" }, host: { properties: { "class.gantt-main-container": "this.ganttMainClass" } }, ngImport: i0, template: "<gantt-links-overlay [flatItems]=\"flatItems\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<div class=\"gantt-main-groups\" [style.width.px]=\"ganttUpper.view.width\">\n @for (data of viewportItems; track trackBy($index, data)) {\n @if (data | isGanttGroup) {\n <div class=\"gantt-group\" [style.height.px]=\"ganttUpper.styles.lineHeight\" [ngClass]=\"data.class\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: data }\"></ng-template>\n </div>\n }\n @if (!(data | isGanttGroup)) {\n <div\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [style]=\"data.laneStyle\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(data.id)\"\n >\n @if (data.type | isGanttCustomItem) {\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: data.origin,\n refs: data.refs,\n baseline: ganttUpper.baselineItemsMap[data.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[data.id]?.refs\n }\"\n >\n </ng-template>\n }\n @if ((data.type | isGanttRangeItem) || (data.type | isGanttBarItem)) {\n @if (data.type | isGanttRangeItem) {\n <gantt-range [template]=\"rangeTemplate\" [item]=\"data\"></gantt-range>\n }\n @if (data.type | isGanttBarItem) {\n <gantt-bar [item]=\"data\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n }\n @if (ganttUpper.baselineItemsMap[data.id]) {\n <gantt-baseline [baselineItem]=\"ganttUpper.baselineItemsMap[data.id]\" [template]=\"baselineTemplate\"></gantt-baseline>\n }\n }\n </div>\n }\n }\n</div>\n\n@if (quickTimeFocus) {\n <div class=\"gantt-quick-time-focus-container\" [style.width.px]=\"ganttUpper.view.width\">\n <div class=\"gantt-quick-time-focus\" [style.width.px]=\"dom.visibleRangeX().max - dom.visibleRangeX().min\">\n @for (data of viewportItems; track trackBy(i, data); let i = $index) {\n @let item = toItemType(data);\n <div class=\"gantt-quick-time-focus-item\" [style.height.px]=\"ganttUpper.styles.lineHeight\">\n <span class=\"ml-2\">\n @if (item.refs?.x < dom.visibleRangeX().min && item.refs?.width) {\n <a class=\"gantt-quick-time-focus-item-arrow link-secondary\" href=\"javascript:;\" (click)=\"quickTime(item.origin, 'left')\">\n <gantt-icon iconName=\"arrow-left\"></gantt-icon>\n </a>\n }\n </span>\n <span class=\"mr-2\">\n @if (item.refs?.x + item.refs?.width > dom.visibleRangeX().max && item.refs?.width) {\n <a class=\"gantt-quick-time-focus-item-arrow link-secondary\" href=\"javascript:;\" (click)=\"quickTime(item.origin, 'right')\">\n <gantt-icon iconName=\"arrow-right\"></gantt-icon>\n </a>\n }\n </span>\n </div>\n }\n </div>\n </div>\n}\n", dependencies: [{ kind: "component", type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: ["flatItems"], outputs: ["lineClick"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range" }, { kind: "component", type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: ["barClick"] }, { kind: "component", type: NgxGanttBaselineComponent, selector: "ngx-gantt-baseline,gantt-baseline", inputs: ["baselineItem", "template"] }, { kind: "component", type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }, { kind: "pipe", type: IsGanttRangeItemPipe, name: "isGanttRangeItem" }, { kind: "pipe", type: IsGanttBarItemPipe, name: "isGanttBarItem" }, { kind: "pipe", type: IsGanttCustomItemPipe, name: "isGanttCustomItem" }, { kind: "pipe", type: IsGanttGroupPipe, name: "isGanttGroup" }] }); }
3800
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.10", type: GanttMainComponent, isStandalone: true, selector: "gantt-main", inputs: { viewportItems: "viewportItems", flatItems: "flatItems", groupHeaderTemplate: "groupHeaderTemplate", itemTemplate: "itemTemplate", barTemplate: "barTemplate", rangeTemplate: "rangeTemplate", baselineTemplate: "baselineTemplate", ganttRoot: "ganttRoot", quickTimeFocus: "quickTimeFocus" }, outputs: { barClick: "barClick", lineClick: "lineClick" }, host: { properties: { "class.gantt-main-container": "this.ganttMainClass" } }, ngImport: i0, template: "<gantt-links-overlay [flatItems]=\"flatItems\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<div class=\"gantt-main-groups\" [style.width.px]=\"ganttUpper.view.width\">\n @for (data of viewportItems; track trackBy($index, data)) {\n @if (data | isGanttGroup) {\n <div class=\"gantt-group\" [style.height.px]=\"ganttUpper.styles.lineHeight\" [ngClass]=\"data.class\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: data }\"></ng-template>\n </div>\n }\n @if (!(data | isGanttGroup)) {\n <div\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [style]=\"data.laneStyle\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(data.id)\"\n >\n @if (data.type | isGanttCustomItem) {\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: data.origin,\n refs: data.refs,\n baseline: ganttUpper.baselineItemsMap[data.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[data.id]?.refs\n }\"\n >\n </ng-template>\n }\n @if ((data.type | isGanttRangeItem) || (data.type | isGanttBarItem)) {\n @if (data.type | isGanttRangeItem) {\n <gantt-range [template]=\"rangeTemplate\" [item]=\"data\"></gantt-range>\n }\n @if (data.type | isGanttBarItem) {\n <gantt-bar [item]=\"data\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n }\n @if (ganttUpper.baselineItemsMap[data.id]) {\n <gantt-baseline [baselineItem]=\"ganttUpper.baselineItemsMap[data.id]\" [template]=\"baselineTemplate\"></gantt-baseline>\n }\n }\n </div>\n }\n }\n</div>\n\n@if (quickTimeFocus) {\n <div class=\"gantt-quick-time-focus-container\" [style.width.px]=\"ganttUpper.view.width\">\n <div class=\"gantt-quick-time-focus\" [style.width.px]=\"dom.visibleRangeX().max - dom.visibleRangeX().min\">\n @for (data of viewportItems; track trackBy(i, data); let i = $index) {\n @let item = toItemType(data);\n <div\n class=\"gantt-quick-time-focus-item\"\n [ngClass]=\"{ 'gantt-quick-time-focus-item-hide': !item?.refs?.width }\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n >\n <span class=\"ml-2\">\n @if (item.refs?.x < dom.visibleRangeX().min && item.refs?.width) {\n <a class=\"gantt-quick-time-focus-item-arrow link-secondary\" href=\"javascript:;\" (click)=\"quickTime(item.origin, 'left')\">\n <gantt-icon iconName=\"arrow-left\"></gantt-icon>\n </a>\n }\n </span>\n <span class=\"mr-2\">\n @if (item.refs?.x + item.refs?.width > dom.visibleRangeX().max && item.refs?.width) {\n <a class=\"gantt-quick-time-focus-item-arrow link-secondary\" href=\"javascript:;\" (click)=\"quickTime(item.origin, 'right')\">\n <gantt-icon iconName=\"arrow-right\"></gantt-icon>\n </a>\n }\n </span>\n </div>\n }\n </div>\n </div>\n}\n", dependencies: [{ kind: "component", type: GanttLinksComponent, selector: "gantt-links-overlay", inputs: ["flatItems"], outputs: ["lineClick"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NgxGanttRangeComponent, selector: "ngx-gantt-range,gantt-range" }, { kind: "component", type: NgxGanttBarComponent, selector: "ngx-gantt-bar,gantt-bar", outputs: ["barClick"] }, { kind: "component", type: NgxGanttBaselineComponent, selector: "ngx-gantt-baseline,gantt-baseline", inputs: ["baselineItem", "template"] }, { kind: "component", type: GanttIconComponent, selector: "gantt-icon", inputs: ["iconName"] }, { kind: "pipe", type: IsGanttRangeItemPipe, name: "isGanttRangeItem" }, { kind: "pipe", type: IsGanttBarItemPipe, name: "isGanttBarItem" }, { kind: "pipe", type: IsGanttCustomItemPipe, name: "isGanttCustomItem" }, { kind: "pipe", type: IsGanttGroupPipe, name: "isGanttGroup" }] }); }
3520
3801
  }
3521
3802
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttMainComponent, decorators: [{
3522
3803
  type: Component,
@@ -3532,7 +3813,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
3532
3813
  IsGanttCustomItemPipe,
3533
3814
  IsGanttGroupPipe,
3534
3815
  GanttIconComponent
3535
- ], template: "<gantt-links-overlay [flatItems]=\"flatItems\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<div class=\"gantt-main-groups\" [style.width.px]=\"ganttUpper.view.width\">\n @for (data of viewportItems; track trackBy($index, data)) {\n @if (data | isGanttGroup) {\n <div class=\"gantt-group\" [style.height.px]=\"ganttUpper.styles.lineHeight\" [ngClass]=\"data.class\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: data }\"></ng-template>\n </div>\n }\n @if (!(data | isGanttGroup)) {\n <div\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [style]=\"data.laneStyle\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(data.id)\"\n >\n @if (data.type | isGanttCustomItem) {\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: data.origin,\n refs: data.refs,\n baseline: ganttUpper.baselineItemsMap[data.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[data.id]?.refs\n }\"\n >\n </ng-template>\n }\n @if ((data.type | isGanttRangeItem) || (data.type | isGanttBarItem)) {\n @if (data.type | isGanttRangeItem) {\n <gantt-range [template]=\"rangeTemplate\" [item]=\"data\"></gantt-range>\n }\n @if (data.type | isGanttBarItem) {\n <gantt-bar [item]=\"data\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n }\n @if (ganttUpper.baselineItemsMap[data.id]) {\n <gantt-baseline [baselineItem]=\"ganttUpper.baselineItemsMap[data.id]\" [template]=\"baselineTemplate\"></gantt-baseline>\n }\n }\n </div>\n }\n }\n</div>\n\n@if (quickTimeFocus) {\n <div class=\"gantt-quick-time-focus-container\" [style.width.px]=\"ganttUpper.view.width\">\n <div class=\"gantt-quick-time-focus\" [style.width.px]=\"dom.visibleRangeX().max - dom.visibleRangeX().min\">\n @for (data of viewportItems; track trackBy(i, data); let i = $index) {\n @let item = toItemType(data);\n <div class=\"gantt-quick-time-focus-item\" [style.height.px]=\"ganttUpper.styles.lineHeight\">\n <span class=\"ml-2\">\n @if (item.refs?.x < dom.visibleRangeX().min && item.refs?.width) {\n <a class=\"gantt-quick-time-focus-item-arrow link-secondary\" href=\"javascript:;\" (click)=\"quickTime(item.origin, 'left')\">\n <gantt-icon iconName=\"arrow-left\"></gantt-icon>\n </a>\n }\n </span>\n <span class=\"mr-2\">\n @if (item.refs?.x + item.refs?.width > dom.visibleRangeX().max && item.refs?.width) {\n <a class=\"gantt-quick-time-focus-item-arrow link-secondary\" href=\"javascript:;\" (click)=\"quickTime(item.origin, 'right')\">\n <gantt-icon iconName=\"arrow-right\"></gantt-icon>\n </a>\n }\n </span>\n </div>\n }\n </div>\n </div>\n}\n" }]
3816
+ ], template: "<gantt-links-overlay [flatItems]=\"flatItems\" (lineClick)=\"lineClick.emit($event)\"></gantt-links-overlay>\n<div class=\"gantt-main-groups\" [style.width.px]=\"ganttUpper.view.width\">\n @for (data of viewportItems; track trackBy($index, data)) {\n @if (data | isGanttGroup) {\n <div class=\"gantt-group\" [style.height.px]=\"ganttUpper.styles.lineHeight\" [ngClass]=\"data.class\">\n <ng-template [ngTemplateOutlet]=\"groupHeaderTemplate\" [ngTemplateOutletContext]=\"{ group: data }\"></ng-template>\n </div>\n }\n @if (!(data | isGanttGroup)) {\n <div\n class=\"gantt-item\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n [style]=\"data.laneStyle\"\n [class.gantt-main-item-active]=\"ganttUpper.isSelected(data.id)\"\n >\n @if (data.type | isGanttCustomItem) {\n <ng-template\n [ngTemplateOutlet]=\"itemTemplate\"\n [ngTemplateOutletContext]=\"{\n item: data.origin,\n refs: data.refs,\n baseline: ganttUpper.baselineItemsMap[data.id]?.origin,\n baselineRefs: ganttUpper.baselineItemsMap[data.id]?.refs\n }\"\n >\n </ng-template>\n }\n @if ((data.type | isGanttRangeItem) || (data.type | isGanttBarItem)) {\n @if (data.type | isGanttRangeItem) {\n <gantt-range [template]=\"rangeTemplate\" [item]=\"data\"></gantt-range>\n }\n @if (data.type | isGanttBarItem) {\n <gantt-bar [item]=\"data\" [template]=\"barTemplate\" (barClick)=\"barClick.emit($event)\"></gantt-bar>\n }\n @if (ganttUpper.baselineItemsMap[data.id]) {\n <gantt-baseline [baselineItem]=\"ganttUpper.baselineItemsMap[data.id]\" [template]=\"baselineTemplate\"></gantt-baseline>\n }\n }\n </div>\n }\n }\n</div>\n\n@if (quickTimeFocus) {\n <div class=\"gantt-quick-time-focus-container\" [style.width.px]=\"ganttUpper.view.width\">\n <div class=\"gantt-quick-time-focus\" [style.width.px]=\"dom.visibleRangeX().max - dom.visibleRangeX().min\">\n @for (data of viewportItems; track trackBy(i, data); let i = $index) {\n @let item = toItemType(data);\n <div\n class=\"gantt-quick-time-focus-item\"\n [ngClass]=\"{ 'gantt-quick-time-focus-item-hide': !item?.refs?.width }\"\n [style.height.px]=\"ganttUpper.styles.lineHeight\"\n >\n <span class=\"ml-2\">\n @if (item.refs?.x < dom.visibleRangeX().min && item.refs?.width) {\n <a class=\"gantt-quick-time-focus-item-arrow link-secondary\" href=\"javascript:;\" (click)=\"quickTime(item.origin, 'left')\">\n <gantt-icon iconName=\"arrow-left\"></gantt-icon>\n </a>\n }\n </span>\n <span class=\"mr-2\">\n @if (item.refs?.x + item.refs?.width > dom.visibleRangeX().max && item.refs?.width) {\n <a class=\"gantt-quick-time-focus-item-arrow link-secondary\" href=\"javascript:;\" (click)=\"quickTime(item.origin, 'right')\">\n <gantt-icon iconName=\"arrow-right\"></gantt-icon>\n </a>\n }\n </span>\n </div>\n }\n </div>\n </div>\n}\n" }]
3536
3817
  }], ctorParameters: () => [], propDecorators: { viewportItems: [{
3537
3818
  type: Input
3538
3819
  }], flatItems: [{
@@ -3577,102 +3858,6 @@ function setStyleWithVendorPrefix({ element, style, value }) {
3577
3858
  }
3578
3859
  }
3579
3860
 
3580
- class GanttSyncScrollService {
3581
- constructor() {
3582
- this.ngZone = inject(NgZone);
3583
- this.scrollGroupsMap = new Map();
3584
- }
3585
- registerScrollEvent(groupName, element, direction) {
3586
- const group = this.scrollGroupsMap.get(groupName) || { elements: [], destroy$: new Subject(), direction };
3587
- group.elements.push(element);
3588
- this.scrollGroupsMap.set(groupName, group);
3589
- this.monitorScrollChange(group);
3590
- }
3591
- unregisterScrollEvent(groupName, element) {
3592
- const group = this.scrollGroupsMap.get(groupName);
3593
- if (group) {
3594
- group.elements = group.elements.filter((el) => el !== element);
3595
- if (!group.elements.length) {
3596
- this.scrollGroupsMap.delete(groupName);
3597
- }
3598
- else {
3599
- this.scrollGroupsMap.set(groupName, group);
3600
- }
3601
- this.monitorScrollChange(group);
3602
- }
3603
- }
3604
- monitorScrollChange(group) {
3605
- const { elements, destroy$, direction } = group;
3606
- destroy$.next();
3607
- destroy$.complete();
3608
- if (elements.length) {
3609
- const scrollObservers = elements.map((el) => fromEvent(el, 'scroll', passiveListenerOptions));
3610
- this.ngZone.runOutsideAngular(() => merge(...scrollObservers)
3611
- .pipe(takeUntil$1(destroy$))
3612
- .subscribe((event) => {
3613
- elements.forEach((el) => {
3614
- if (direction === 'x') {
3615
- el.scrollLeft = event.currentTarget.scrollLeft;
3616
- }
3617
- else {
3618
- el.scrollTop = event.currentTarget.scrollTop;
3619
- }
3620
- });
3621
- }));
3622
- }
3623
- }
3624
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
3625
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollService }); }
3626
- }
3627
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollService, decorators: [{
3628
- type: Injectable
3629
- }], ctorParameters: () => [] });
3630
-
3631
- class GanttSyncScrollXDirective {
3632
- constructor() {
3633
- this.syncScrollX = input(...(ngDevMode ? [undefined, { debugName: "syncScrollX" }] : []));
3634
- this.elementRef = inject((ElementRef));
3635
- this.syncScrollService = inject(GanttSyncScrollService);
3636
- }
3637
- ngOnInit() {
3638
- this.syncScrollService.registerScrollEvent(this.syncScrollX(), this.elementRef.nativeElement, 'x');
3639
- }
3640
- ngOnDestroy() {
3641
- this.syncScrollService.unregisterScrollEvent(this.syncScrollX(), this.elementRef.nativeElement);
3642
- }
3643
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollXDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3644
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.10", type: GanttSyncScrollXDirective, isStandalone: true, selector: "[syncScrollX]", inputs: { syncScrollX: { classPropertyName: "syncScrollX", publicName: "syncScrollX", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
3645
- }
3646
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollXDirective, decorators: [{
3647
- type: Directive,
3648
- args: [{
3649
- selector: '[syncScrollX]',
3650
- standalone: true
3651
- }]
3652
- }], ctorParameters: () => [], propDecorators: { syncScrollX: [{ type: i0.Input, args: [{ isSignal: true, alias: "syncScrollX", required: false }] }] } });
3653
- class GanttSyncScrollYDirective {
3654
- constructor() {
3655
- this.syncScrollY = input(...(ngDevMode ? [undefined, { debugName: "syncScrollY" }] : []));
3656
- this.syncScrollService = inject(GanttSyncScrollService);
3657
- this.elementRef = inject((ElementRef));
3658
- }
3659
- ngOnInit() {
3660
- this.syncScrollService.registerScrollEvent(this.syncScrollY(), this.elementRef.nativeElement, 'y');
3661
- }
3662
- ngOnDestroy() {
3663
- this.syncScrollService.unregisterScrollEvent(this.syncScrollY(), this.elementRef.nativeElement);
3664
- }
3665
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollYDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
3666
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.10", type: GanttSyncScrollYDirective, isStandalone: true, selector: "[syncScrollY]", inputs: { syncScrollY: { classPropertyName: "syncScrollY", publicName: "syncScrollY", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
3667
- }
3668
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttSyncScrollYDirective, decorators: [{
3669
- type: Directive,
3670
- args: [{
3671
- selector: '[syncScrollY]',
3672
- standalone: true
3673
- }]
3674
- }], ctorParameters: () => [], propDecorators: { syncScrollY: [{ type: i0.Input, args: [{ isSignal: true, alias: "syncScrollY", required: false }] }] } });
3675
-
3676
3861
  const defaultColumnWidth = 100;
3677
3862
  const minColumnWidth = 80;
3678
3863
  class GanttTableHeaderComponent {
@@ -4121,145 +4306,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
4121
4306
  args: [(CdkDrag)]
4122
4307
  }] } });
4123
4308
 
4124
- class NgxGanttToolbarComponent {
4125
- get top() {
4126
- return this.ganttUpper.styles.headerHeight + 16 + 'px';
4127
- }
4128
- constructor() {
4129
- this.ganttUpper = inject(GANTT_UPPER_TOKEN);
4130
- this.ganttItemClass = true;
4131
- this.views = inject(GanttConfigService).getViewsLocale();
4132
- }
4133
- selectView(view) {
4134
- this.ganttUpper.changeView(view);
4135
- }
4136
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: NgxGanttToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4137
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.10", 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"] }] }); }
4138
- }
4139
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
4140
- type: Component,
4141
- 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" }]
4142
- }], ctorParameters: () => [], propDecorators: { template: [{
4143
- type: Input
4144
- }], ganttItemClass: [{
4145
- type: HostBinding,
4146
- args: ['class.gantt-toolbar']
4147
- }], top: [{
4148
- type: HostBinding,
4149
- args: ['style.top']
4150
- }] } });
4151
-
4152
- class GanttScrollbarComponent {
4153
- constructor() {
4154
- this.ganttUpper = inject(GANTT_UPPER_TOKEN);
4155
- this.hasFooter = input(false, ...(ngDevMode ? [{ debugName: "hasFooter" }] : []));
4156
- this.tableWidth = input(...(ngDevMode ? [undefined, { debugName: "tableWidth" }] : []));
4157
- this.ganttRoot = input(...(ngDevMode ? [undefined, { debugName: "ganttRoot" }] : []));
4158
- this.tableScrollWidth = input(0, ...(ngDevMode ? [{ debugName: "tableScrollWidth" }] : []));
4159
- }
4160
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttScrollbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4161
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.10", 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"] }] }); }
4162
- }
4163
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttScrollbarComponent, decorators: [{
4164
- type: Component,
4165
- 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" }]
4166
- }], ctorParameters: () => [], propDecorators: { hasFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasFooter", required: false }] }], tableWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableWidth", required: false }] }], ganttRoot: [{ type: i0.Input, args: [{ isSignal: true, alias: "ganttRoot", required: false }] }], tableScrollWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableScrollWidth", required: false }] }] } });
4167
-
4168
- class GanttPrintService {
4169
- constructor() { }
4170
- setInlineStyles(targetElem) {
4171
- const svgElements = Array.from(targetElem.getElementsByTagName('svg'));
4172
- for (const svgElement of svgElements) {
4173
- this.recursElementChildren(svgElement);
4174
- }
4175
- }
4176
- recursElementChildren(node) {
4177
- const transformProperties = [
4178
- 'fill',
4179
- 'color',
4180
- 'font-size',
4181
- 'stroke',
4182
- 'font',
4183
- 'text-anchor',
4184
- 'stroke-dasharray',
4185
- 'shape-rendering',
4186
- 'stroke-width'
4187
- ];
4188
- if (!node.style) {
4189
- return;
4190
- }
4191
- const styles = getComputedStyle(node);
4192
- for (const transformProperty of transformProperties) {
4193
- node.style[transformProperty] = styles[transformProperty];
4194
- }
4195
- for (const child of Array.from(node.childNodes)) {
4196
- this.recursElementChildren(child);
4197
- }
4198
- }
4199
- register(root) {
4200
- this.root = root.nativeElement;
4201
- this.mainContainer = this.root.getElementsByClassName('gantt-main-container')[0];
4202
- }
4203
- async html2canvas(ignoreElementClass) {
4204
- const root = this.root;
4205
- const mainContainer = this.mainContainer;
4206
- // set print width
4207
- const printWidth = root.offsetWidth;
4208
- // set print height
4209
- const printHeight = root.offsetHeight - mainContainer.offsetHeight + mainContainer.scrollHeight;
4210
- const html2canvas = (await import(/* webpackChunkName: 'html2canvas' */ 'html2canvas')).default;
4211
- return html2canvas(root, {
4212
- logging: false,
4213
- allowTaint: true,
4214
- useCORS: true,
4215
- width: printWidth,
4216
- height: printHeight,
4217
- ignoreElements: (element) => {
4218
- if (ignoreElementClass && element.classList.contains(ignoreElementClass)) {
4219
- return true;
4220
- }
4221
- if (element.classList.contains('gantt-calendar-today-overlay')) {
4222
- return true;
4223
- }
4224
- },
4225
- onclone: (cloneDocument) => {
4226
- const ganttClass = root.className;
4227
- const cloneGanttDom = cloneDocument.querySelector(`.${ganttClass.replace(/\s+/g, '.')}`);
4228
- const cloneGanttContainerDom = cloneDocument.querySelector('.gantt-container');
4229
- const cloneCalendarOverlay = cloneDocument.querySelector('.gantt-calendar-grid-main');
4230
- const cloneLinksOverlay = cloneDocument.querySelector('.gantt-links-overlay-main');
4231
- // change targetDom width
4232
- cloneGanttDom.style.width = `${printWidth}px`;
4233
- cloneGanttDom.style.height = `${printHeight}px`;
4234
- cloneGanttDom.style.overflow = `unset`;
4235
- cloneGanttContainerDom.style.backgroundColor = '#fff';
4236
- cloneCalendarOverlay.setAttribute('height', `${printHeight}`);
4237
- cloneCalendarOverlay.setAttribute('style', `background: transparent`);
4238
- if (cloneLinksOverlay) {
4239
- cloneLinksOverlay.setAttribute('height', `${printHeight}`);
4240
- cloneLinksOverlay.setAttribute('style', `height: ${printHeight}px`);
4241
- }
4242
- // setInlineStyles for svg
4243
- this.setInlineStyles(cloneGanttDom);
4244
- }
4245
- });
4246
- }
4247
- async print(name = 'download', ignoreElementClass) {
4248
- this.html2canvas(ignoreElementClass).then((canvas) => {
4249
- const link = document.createElement('a');
4250
- const dataUrl = canvas.toDataURL('image/png');
4251
- link.download = `${name}.png`;
4252
- link.href = dataUrl;
4253
- link.click();
4254
- });
4255
- }
4256
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttPrintService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4257
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttPrintService }); }
4258
- }
4259
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: GanttPrintService, decorators: [{
4260
- type: Injectable
4261
- }], ctorParameters: () => [] });
4262
-
4263
4309
  class NgxGanttRootComponent {
4264
4310
  get view() {
4265
4311
  return this.ganttUpper.view;
@@ -4970,5 +5016,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
4970
5016
  * Generated bundle index. Do not edit.
4971
5017
  */
4972
5018
 
4973
- 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 };
5019
+ 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, GanttSyncScrollService, GanttSyncScrollXDirective, GanttSyncScrollYDirective, 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 };
4974
5020
  //# sourceMappingURL=worktile-gantt.mjs.map