@worktile/gantt 18.0.5 → 18.1.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/class/item.d.ts +2 -2
  2. package/class/view-type.d.ts +0 -4
  3. package/components/toolbar/toolbar.component.d.ts +1 -6
  4. package/esm2022/class/item.mjs +1 -1
  5. package/esm2022/class/view-type.mjs +1 -23
  6. package/esm2022/components/bar/bar-drag.mjs +3 -3
  7. package/esm2022/components/toolbar/toolbar.component.mjs +6 -7
  8. package/esm2022/gantt-upper.mjs +17 -15
  9. package/esm2022/gantt.component.mjs +1 -1
  10. package/esm2022/gantt.config.mjs +48 -12
  11. package/esm2022/gantt.module.mjs +27 -20
  12. package/esm2022/gantt.pipe.mjs +16 -1
  13. package/esm2022/i18n/i18n.mjs +12 -0
  14. package/esm2022/i18n/index.mjs +18 -0
  15. package/esm2022/i18n/locales/de-de.mjs +51 -0
  16. package/esm2022/i18n/locales/en-us.mjs +49 -0
  17. package/esm2022/i18n/locales/ja-jp.mjs +49 -0
  18. package/esm2022/i18n/locales/ru-ru.mjs +51 -0
  19. package/esm2022/i18n/locales/zh-hans.mjs +49 -0
  20. package/esm2022/i18n/locales/zh-hant.mjs +49 -0
  21. package/esm2022/public-api.mjs +2 -1
  22. package/esm2022/root.component.mjs +2 -2
  23. package/esm2022/utils/date.mjs +9 -4
  24. package/esm2022/views/day.mjs +6 -4
  25. package/esm2022/views/hour.mjs +5 -3
  26. package/esm2022/views/month.mjs +6 -4
  27. package/esm2022/views/quarter.mjs +6 -4
  28. package/esm2022/views/view.mjs +2 -3
  29. package/esm2022/views/week.mjs +6 -4
  30. package/esm2022/views/year.mjs +5 -3
  31. package/fesm2022/worktile-gantt.mjs +449 -102
  32. package/fesm2022/worktile-gantt.mjs.map +1 -1
  33. package/gantt-upper.d.ts +5 -3
  34. package/gantt.component.d.ts +1 -1
  35. package/gantt.config.d.ts +19 -0
  36. package/gantt.module.d.ts +3 -4
  37. package/gantt.pipe.d.ts +5 -0
  38. package/i18n/i18n.d.ts +23 -0
  39. package/i18n/index.d.ts +10 -0
  40. package/i18n/locales/de-de.d.ts +49 -0
  41. package/i18n/locales/en-us.d.ts +48 -0
  42. package/i18n/locales/ja-jp.d.ts +48 -0
  43. package/i18n/locales/ru-ru.d.ts +49 -0
  44. package/i18n/locales/zh-hans.d.ts +48 -0
  45. package/i18n/locales/zh-hant.d.ts +48 -0
  46. package/package.json +3 -2
  47. package/public-api.d.ts +1 -0
  48. package/root.component.d.ts +1 -1
  49. package/utils/date.d.ts +3 -1
  50. package/views/view.d.ts +9 -0
@@ -4,14 +4,17 @@ import * as i1$1 from '@angular/cdk/scrolling';
4
4
  import { CdkScrollable, CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf, ScrollingModule } from '@angular/cdk/scrolling';
5
5
  import { isPlatformServer, NgIf, NgTemplateOutlet, NgFor, NgStyle, NgClass, DOCUMENT, CommonModule } from '@angular/common';
6
6
  import * as i0 from '@angular/core';
7
- import { InjectionToken, EventEmitter, Directive, Inject, Input, Output, ContentChild, HostBinding, Injectable, signal, PLATFORM_ID, effect, Component, ViewChild, ViewChildren, Pipe, ElementRef, Optional, HostListener, forwardRef, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
7
+ import { InjectionToken, inject, Injectable, Inject, EventEmitter, Directive, Input, Output, ContentChild, HostBinding, signal, PLATFORM_ID, effect, Component, ViewChild, ViewChildren, Pipe, ElementRef, Optional, HostListener, forwardRef, ChangeDetectionStrategy, ContentChildren, NgModule } from '@angular/core';
8
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';
9
9
  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
10
  import { BehaviorSubject, Subject, from, fromEvent, merge, Observable, EMPTY, interval, animationFrameScheduler, take as take$1, takeUntil as takeUntil$1, combineLatest, startWith as startWith$1, auditTime as auditTime$1, filter } from 'rxjs';
11
11
  import { take, takeUntil, skip, map, pairwise, auditTime, startWith, switchMap, debounceTime, finalize } from 'rxjs/operators';
12
+ import { TZDate } from '@date-fns/tz';
13
+ import { de, ru } from 'date-fns/locale';
12
14
  import { SelectionModel } from '@angular/cdk/collections';
13
15
  import { coerceBooleanProperty, coerceCssPixelValue } from '@angular/cdk/coercion';
14
16
  import { __decorate, __param } from 'tslib';
17
+ import { setDefaultTimeZone as setDefaultTimeZone$1 } from 'ngx-gantt';
15
18
 
16
19
  class GanttDatePoint {
17
20
  constructor(start, text, x, y, additions, style) {
@@ -51,6 +54,10 @@ class GanttTableDragEnterPredicateContext {
51
54
  class GanttVirtualScrolledIndexChangeEvent {
52
55
  }
53
56
 
57
+ let timeZone;
58
+ function setDefaultTimeZone(zone) {
59
+ timeZone = zone ?? undefined;
60
+ }
54
61
  class GanttDate {
55
62
  constructor(date) {
56
63
  if (date) {
@@ -59,10 +66,10 @@ class GanttDate {
59
66
  }
60
67
  else if (typeof date === 'string' || typeof date === 'number') {
61
68
  if (date.toString().length < 13) {
62
- this.value = fromUnixTime(+date);
69
+ this.value = new TZDate(fromUnixTime(+date), timeZone);
63
70
  }
64
71
  else {
65
- this.value = new Date(date);
72
+ this.value = new TZDate(date, timeZone);
66
73
  }
67
74
  }
68
75
  else {
@@ -71,7 +78,7 @@ class GanttDate {
71
78
  }
72
79
  }
73
80
  else {
74
- this.value = new Date();
81
+ this.value = new TZDate(new Date(), timeZone);
75
82
  }
76
83
  }
77
84
  getYear() {
@@ -348,28 +355,6 @@ var GanttViewType;
348
355
  GanttViewType["week"] = "week";
349
356
  GanttViewType["hour"] = "hour";
350
357
  })(GanttViewType || (GanttViewType = {}));
351
- const ganttViews = [
352
- {
353
- name: '日',
354
- value: GanttViewType.day
355
- },
356
- {
357
- name: '周',
358
- value: GanttViewType.week
359
- },
360
- {
361
- name: '月',
362
- value: GanttViewType.month
363
- },
364
- {
365
- name: '季',
366
- value: GanttViewType.quarter
367
- },
368
- {
369
- name: '年',
370
- value: GanttViewType.year
371
- }
372
- ];
373
358
 
374
359
  class GanttBaselineItemInternal {
375
360
  get refs() {
@@ -387,36 +372,11 @@ class GanttBaselineItemInternal {
387
372
  }
388
373
  }
389
374
 
390
- const defaultConfig = {
391
- dateFormat: {
392
- hour: 'HH:mm',
393
- day: 'M月d日',
394
- week: '第w周',
395
- month: 'M月',
396
- quarter: 'QQQ',
397
- year: 'yyyy年',
398
- yearMonth: 'yyyy年MM月',
399
- yearQuarter: 'yyyy年QQQ'
400
- },
401
- linkOptions: {
402
- dependencyTypes: [GanttLinkType.fs],
403
- showArrow: false,
404
- lineType: GanttLinkLineType.curve
405
- },
406
- styleOptions: {
407
- headerHeight: 44,
408
- lineHeight: 44,
409
- barHeight: 22
410
- }
411
- };
412
- const GANTT_GLOBAL_CONFIG = new InjectionToken('GANTT_GLOBAL_CONFIG');
413
-
414
375
  const primaryDatePointTop = '40%';
415
376
  const secondaryDatePointTop = '80%';
416
377
  const viewOptions$6 = {
417
378
  min: new GanttDate().addYears(-1).startOfYear(),
418
379
  max: new GanttDate().addYears(1).endOfYear(),
419
- dateFormat: defaultConfig.dateFormat,
420
380
  datePrecisionUnit: 'day',
421
381
  dragPreviewDateFormat: 'MM-dd'
422
382
  };
@@ -429,6 +389,7 @@ class GanttView {
429
389
  }
430
390
  constructor(start, end, options) {
431
391
  this.showTimeline = true;
392
+ this.dateFormats = {};
432
393
  this.options = Object.assign({}, viewOptions$6, options);
433
394
  const startDate = start.isCustom
434
395
  ? this.viewStartOf(start.date)
@@ -585,12 +546,317 @@ class GanttView {
585
546
  }
586
547
  }
587
548
 
549
+ var GanttI18nLocale;
550
+ (function (GanttI18nLocale) {
551
+ GanttI18nLocale["zhHans"] = "zh-hans";
552
+ GanttI18nLocale["zhHant"] = "zh-hant";
553
+ GanttI18nLocale["enUs"] = "en-us";
554
+ GanttI18nLocale["deDe"] = "de-de";
555
+ GanttI18nLocale["jaJp"] = "ja-jp";
556
+ GanttI18nLocale["ruRu"] = "ru-ru";
557
+ })(GanttI18nLocale || (GanttI18nLocale = {}));
558
+ const GANTT_I18N_LOCALE_TOKEN = new InjectionToken('gantt-i18n-locale');
559
+
560
+ var zhHans = {
561
+ id: GanttI18nLocale.zhHans,
562
+ views: {
563
+ [GanttViewType.hour]: {
564
+ label: '小时',
565
+ dateFormats: {
566
+ primary: 'M月d日',
567
+ secondary: 'HH:mm'
568
+ }
569
+ },
570
+ [GanttViewType.day]: {
571
+ label: '天',
572
+ dateFormats: {
573
+ primary: 'yyyy年MM月',
574
+ secondary: 'd'
575
+ }
576
+ },
577
+ [GanttViewType.week]: {
578
+ label: '周',
579
+ dateFormats: {
580
+ primary: 'yyyy年',
581
+ secondary: '第w周'
582
+ }
583
+ },
584
+ [GanttViewType.month]: {
585
+ label: '月',
586
+ dateFormats: {
587
+ primary: `yyyy年'Q'Q`,
588
+ secondary: 'M月'
589
+ }
590
+ },
591
+ [GanttViewType.quarter]: {
592
+ label: '季',
593
+ dateFormats: {
594
+ primary: 'yyyy年',
595
+ secondary: `yyyy年'Q'Q`
596
+ }
597
+ },
598
+ [GanttViewType.year]: {
599
+ label: '年',
600
+ dateFormats: {
601
+ secondary: 'yyyy年'
602
+ }
603
+ }
604
+ }
605
+ };
606
+
607
+ var zhHant = {
608
+ id: GanttI18nLocale.zhHant,
609
+ views: {
610
+ [GanttViewType.hour]: {
611
+ label: '小時',
612
+ dateFormats: {
613
+ primary: 'M月d日',
614
+ secondary: 'HH:mm'
615
+ }
616
+ },
617
+ [GanttViewType.day]: {
618
+ label: '天',
619
+ dateFormats: {
620
+ primary: 'yyyy年MM月',
621
+ secondary: 'd'
622
+ }
623
+ },
624
+ [GanttViewType.week]: {
625
+ label: '週',
626
+ dateFormats: {
627
+ primary: 'yyyy年',
628
+ secondary: '第w週'
629
+ }
630
+ },
631
+ [GanttViewType.month]: {
632
+ label: '月',
633
+ dateFormats: {
634
+ primary: `yyyy年'Q'Q`,
635
+ secondary: 'M月'
636
+ }
637
+ },
638
+ [GanttViewType.quarter]: {
639
+ label: '季',
640
+ dateFormats: {
641
+ primary: 'yyyy年',
642
+ secondary: `yyyy年'Q'Q`
643
+ }
644
+ },
645
+ [GanttViewType.year]: {
646
+ label: '年',
647
+ dateFormats: {
648
+ secondary: 'yyyy年'
649
+ }
650
+ }
651
+ }
652
+ };
653
+
654
+ var enUsLocale = {
655
+ id: GanttI18nLocale.enUs,
656
+ views: {
657
+ [GanttViewType.hour]: {
658
+ label: 'Hourly',
659
+ dateFormats: {
660
+ primary: 'MMM d',
661
+ secondary: 'HH:mm'
662
+ }
663
+ },
664
+ [GanttViewType.day]: {
665
+ label: 'Daily',
666
+ dateFormats: {
667
+ primary: 'MMM yyyy',
668
+ secondary: 'd'
669
+ }
670
+ },
671
+ [GanttViewType.week]: {
672
+ label: 'Weekly',
673
+ dateFormats: {
674
+ primary: 'yyyy',
675
+ secondary: 'wo'
676
+ }
677
+ },
678
+ [GanttViewType.month]: {
679
+ label: 'Monthly',
680
+ dateFormats: {
681
+ primary: "yyyy 'Q'Q",
682
+ secondary: 'MMM'
683
+ }
684
+ },
685
+ [GanttViewType.quarter]: {
686
+ label: 'Quarterly',
687
+ dateFormats: {
688
+ primary: 'yyyy',
689
+ secondary: "yyyy 'Q'Q"
690
+ }
691
+ },
692
+ [GanttViewType.year]: {
693
+ label: 'Yearly',
694
+ dateFormats: {
695
+ secondary: 'yyyy'
696
+ }
697
+ }
698
+ }
699
+ };
700
+
701
+ var jaJpLocale = {
702
+ id: GanttI18nLocale.jaJp,
703
+ views: {
704
+ [GanttViewType.hour]: {
705
+ label: '毎時',
706
+ dateFormats: {
707
+ primary: 'M月d日',
708
+ secondary: 'HH:mm'
709
+ }
710
+ },
711
+ [GanttViewType.day]: {
712
+ label: '日',
713
+ dateFormats: {
714
+ primary: 'yyyy年M月d日',
715
+ secondary: 'd'
716
+ }
717
+ },
718
+ [GanttViewType.week]: {
719
+ label: '週',
720
+ dateFormats: {
721
+ primary: 'yyyy年',
722
+ secondary: '第w週'
723
+ }
724
+ },
725
+ [GanttViewType.month]: {
726
+ label: '月',
727
+ dateFormats: {
728
+ primary: `yyyy年M月`,
729
+ secondary: 'M月'
730
+ }
731
+ },
732
+ [GanttViewType.quarter]: {
733
+ label: '四半期',
734
+ dateFormats: {
735
+ primary: 'yyyy年',
736
+ secondary: `yyyy年第Q四半期`
737
+ }
738
+ },
739
+ [GanttViewType.year]: {
740
+ label: '年',
741
+ dateFormats: {
742
+ secondary: 'yyyy年'
743
+ }
744
+ }
745
+ }
746
+ };
747
+
748
+ var deDeLocale = {
749
+ id: GanttI18nLocale.deDe,
750
+ dateLocale: de,
751
+ views: {
752
+ [GanttViewType.hour]: {
753
+ label: 'Stündlich',
754
+ dateFormats: {
755
+ primary: 'dd. MMM',
756
+ secondary: 'HH:mm'
757
+ }
758
+ },
759
+ [GanttViewType.day]: {
760
+ label: 'Täglich',
761
+ dateFormats: {
762
+ primary: 'MMM yyyy',
763
+ secondary: 'd'
764
+ }
765
+ },
766
+ [GanttViewType.week]: {
767
+ label: 'Wöchentlich',
768
+ dateFormats: {
769
+ primary: 'yyyy',
770
+ secondary: `w. 'Woche'`
771
+ }
772
+ },
773
+ [GanttViewType.month]: {
774
+ label: 'Monatlich',
775
+ dateFormats: {
776
+ primary: 'MMM yyyy',
777
+ secondary: 'MMM'
778
+ }
779
+ },
780
+ [GanttViewType.quarter]: {
781
+ label: 'Vierteljährlich',
782
+ dateFormats: {
783
+ primary: 'yyyy',
784
+ secondary: `Q. 'Quartal' yyyy`
785
+ }
786
+ },
787
+ [GanttViewType.year]: {
788
+ label: 'Jährlich',
789
+ dateFormats: {
790
+ secondary: 'yyyy'
791
+ }
792
+ }
793
+ }
794
+ };
795
+
796
+ var ruRuLocale = {
797
+ id: GanttI18nLocale.ruRu,
798
+ dateLocale: ru,
799
+ views: {
800
+ [GanttViewType.hour]: {
801
+ label: 'Ежечасно',
802
+ dateFormats: {
803
+ primary: 'd MMM',
804
+ secondary: 'HH:mm'
805
+ }
806
+ },
807
+ [GanttViewType.day]: {
808
+ label: 'Ежедневно',
809
+ dateFormats: {
810
+ primary: 'MMMM yyyy',
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: 'MMMM yyyy',
825
+ secondary: 'MMM'
826
+ }
827
+ },
828
+ [GanttViewType.quarter]: {
829
+ label: 'Ежеквартально',
830
+ dateFormats: {
831
+ primary: 'yyyy',
832
+ secondary: 'Квартал Q yyyy'
833
+ }
834
+ },
835
+ [GanttViewType.year]: {
836
+ label: 'Ежегодно',
837
+ dateFormats: {
838
+ secondary: 'yyyy'
839
+ }
840
+ }
841
+ }
842
+ };
843
+
844
+ const i18nLocaleProvides = [
845
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: zhHans, multi: true },
846
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: zhHant, multi: true },
847
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: enUsLocale, multi: true },
848
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: jaJpLocale, multi: true },
849
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: deDeLocale, multi: true },
850
+ { provide: GANTT_I18N_LOCALE_TOKEN, useValue: ruRuLocale, multi: true }
851
+ ];
852
+
588
853
  const viewOptions$5 = {
589
854
  start: new GanttDate().startOfQuarter().addQuarters(-1),
590
855
  end: new GanttDate().endOfQuarter().addQuarters(2),
591
856
  cellWidth: 280,
592
857
  addAmount: 1,
593
- addUnit: 'quarter'
858
+ addUnit: 'quarter',
859
+ dateDisplayFormats: zhHant.views.month.dateFormats
594
860
  };
595
861
  class GanttViewMonth extends GanttView {
596
862
  constructor(start, end, options) {
@@ -614,7 +880,7 @@ class GanttViewMonth extends GanttView {
614
880
  const points = [];
615
881
  for (let i = 0; i < quarters; i++) {
616
882
  const start = this.start.addQuarters(i);
617
- const point = new GanttDatePoint(start, start.format(this.options.dateFormat.yearQuarter), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
883
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.yearQuarter || this.options.dateDisplayFormats.primary), (this.getCellWidth() * 3) / 2 + i * (this.getCellWidth() * 3), primaryDatePointTop);
618
884
  points.push(point);
619
885
  }
620
886
  return points;
@@ -624,7 +890,7 @@ class GanttViewMonth extends GanttView {
624
890
  const points = [];
625
891
  for (let i = 0; i < months.length; i++) {
626
892
  const start = new GanttDate(months[i]);
627
- const point = new GanttDatePoint(start, start.format(this.options.dateFormat.month), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
893
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.month || this.options.dateDisplayFormats.secondary), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
628
894
  points.push(point);
629
895
  }
630
896
  return points;
@@ -638,7 +904,8 @@ const viewOptions$4 = {
638
904
  max: new GanttDate().addYears(2).endOfYear(),
639
905
  cellWidth: 500,
640
906
  addAmount: 1,
641
- addUnit: 'year'
907
+ addUnit: 'year',
908
+ dateDisplayFormats: zhHant.views.quarter.dateFormats
642
909
  };
643
910
  class GanttViewQuarter extends GanttView {
644
911
  constructor(start, end, options) {
@@ -662,7 +929,7 @@ class GanttViewQuarter extends GanttView {
662
929
  const points = [];
663
930
  for (let i = 0; i < years.length; i++) {
664
931
  const start = new GanttDate(years[i]);
665
- const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat.year)}`, (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
932
+ const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat?.year || this.options.dateDisplayFormats.primary)}`, (this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4), primaryDatePointTop);
666
933
  points.push(point);
667
934
  }
668
935
  return points;
@@ -672,7 +939,7 @@ class GanttViewQuarter extends GanttView {
672
939
  const points = [];
673
940
  for (let i = 0; i <= quarters; i++) {
674
941
  const start = this.start.addQuarters(i);
675
- const point = new GanttDatePoint(start, start.format(this.options.dateFormat.quarter), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
942
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.quarter || this.options.dateDisplayFormats.secondary), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
676
943
  points.push(point);
677
944
  }
678
945
  return points;
@@ -684,7 +951,8 @@ const viewOptions$3 = {
684
951
  start: new GanttDate().startOfYear().startOfWeek(),
685
952
  end: new GanttDate().endOfYear().endOfWeek(),
686
953
  addAmount: 1,
687
- addUnit: 'month'
954
+ addUnit: 'month',
955
+ dateDisplayFormats: zhHant.views.day.dateFormats
688
956
  };
689
957
  class GanttViewDay extends GanttView {
690
958
  constructor(start, end, options) {
@@ -711,7 +979,7 @@ class GanttViewDay extends GanttView {
711
979
  for (let i = 0; i < weeks.length; i++) {
712
980
  const weekStart = new GanttDate(weeks[i]);
713
981
  const increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
714
- const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.yearMonth), (this.getCellWidth() * 7) / 2 + i * (this.getCellWidth() * 7), primaryDatePointTop);
982
+ 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);
715
983
  points.push(point);
716
984
  }
717
985
  return points;
@@ -721,7 +989,7 @@ class GanttViewDay extends GanttView {
721
989
  const points = [];
722
990
  for (let i = 0; i < days.length; i++) {
723
991
  const start = new GanttDate(days[i]);
724
- const point = new GanttDatePoint(start, start.getDate().toString(), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop, {
992
+ const point = new GanttDatePoint(start, start.format(this.options.dateDisplayFormats.secondary) || start.getDate().toString(), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop, {
725
993
  isWeekend: start.isWeekend(),
726
994
  isToday: start.isToday()
727
995
  });
@@ -736,7 +1004,8 @@ const viewOptions$2 = {
736
1004
  start: new GanttDate().startOfYear().startOfWeek(),
737
1005
  end: new GanttDate().endOfYear().endOfWeek(),
738
1006
  addAmount: 1,
739
- addUnit: 'month'
1007
+ addUnit: 'month',
1008
+ dateDisplayFormats: zhHant.views.week.dateFormats
740
1009
  };
741
1010
  class GanttViewWeek extends GanttView {
742
1011
  constructor(start, end, options) {
@@ -761,7 +1030,7 @@ class GanttViewWeek extends GanttView {
761
1030
  for (let i = 0; i < weeks.length; i++) {
762
1031
  const weekStart = new GanttDate(weeks[i]);
763
1032
  const increaseWeek = weekStart.getDaysInMonth() - weekStart.getDate() >= 3 ? 0 : 1;
764
- const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat.year), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
1033
+ const point = new GanttDatePoint(weekStart, weekStart.addWeeks(increaseWeek).format(this.options.dateFormat?.year || this.options.dateDisplayFormats.primary), this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
765
1034
  points.push(point);
766
1035
  }
767
1036
  return points;
@@ -771,7 +1040,7 @@ class GanttViewWeek extends GanttView {
771
1040
  const points = [];
772
1041
  for (let i = 0; i < weeks.length; i++) {
773
1042
  const start = new GanttDate(weeks[i]);
774
- const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat.week)}`, i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
1043
+ const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat?.week || this.options.dateDisplayFormats.secondary)}`, i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop);
775
1044
  points.push(point);
776
1045
  }
777
1046
  return points;
@@ -783,7 +1052,8 @@ const viewOptions$1 = {
783
1052
  start: new GanttDate().addYears(-2).startOfYear(),
784
1053
  end: new GanttDate().addYears(2).endOfYear(),
785
1054
  addAmount: 1,
786
- addUnit: 'year'
1055
+ addUnit: 'year',
1056
+ dateDisplayFormats: zhHant.views.year.dateFormats
787
1057
  };
788
1058
  class GanttViewYear extends GanttView {
789
1059
  constructor(start, end, options) {
@@ -818,7 +1088,7 @@ class GanttViewYear extends GanttView {
818
1088
  const pointTop = '60%';
819
1089
  for (let i = 0; i <= years; i++) {
820
1090
  const start = this.start.addYears(i);
821
- const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat.year)}`, i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
1091
+ const point = new GanttDatePoint(start, `${start.format(this.options.dateFormat?.year || this.options.dateDisplayFormats.secondary || this.options.dateDisplayFormats.primary)}`, i * this.getCellWidth() + this.getCellWidth() / 2, pointTop);
822
1092
  points.push(point);
823
1093
  }
824
1094
  return points;
@@ -832,6 +1102,7 @@ const viewOptions = {
832
1102
  datePrecisionUnit: 'minute',
833
1103
  addAmount: 1,
834
1104
  addUnit: 'week',
1105
+ dateDisplayFormats: zhHant.views.hour.dateFormats,
835
1106
  dragPreviewDateFormat: 'HH:mm'
836
1107
  };
837
1108
  class GanttViewHour extends GanttView {
@@ -861,7 +1132,7 @@ class GanttViewHour extends GanttView {
861
1132
  const points = [];
862
1133
  for (let i = 0; i < days.length; i++) {
863
1134
  const start = this.start.addDays(i);
864
- const point = new GanttDatePoint(start, start.format(this.options.dateFormat.day), (this.getCellWidth() * 24) / 2 + i * (this.getCellWidth() * 24), primaryDatePointTop);
1135
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.day || this.options.dateDisplayFormats.primary), (this.getCellWidth() * 24) / 2 + i * (this.getCellWidth() * 24), primaryDatePointTop);
865
1136
  points.push(point);
866
1137
  }
867
1138
  return points;
@@ -871,7 +1142,7 @@ class GanttViewHour extends GanttView {
871
1142
  const points = [];
872
1143
  for (let i = 0; i < hours.length; i++) {
873
1144
  const start = new GanttDate(hours[i]);
874
- const point = new GanttDatePoint(start, start.format(this.options.dateFormat.hour), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop, {
1145
+ const point = new GanttDatePoint(start, start.format(this.options.dateFormat?.hour || this.options.dateDisplayFormats.secondary), i * this.getCellWidth() + this.getCellWidth() / 2, secondaryDatePointTop, {
875
1146
  isWeekend: start.isWeekend(),
876
1147
  isToday: start.isToday()
877
1148
  });
@@ -996,12 +1267,67 @@ function keyBy(array, key) {
996
1267
  return result;
997
1268
  }
998
1269
 
1270
+ const defaultConfig = {
1271
+ locale: GanttI18nLocale.zhHans,
1272
+ linkOptions: {
1273
+ dependencyTypes: [GanttLinkType.fs],
1274
+ showArrow: false,
1275
+ lineType: GanttLinkLineType.curve
1276
+ },
1277
+ styleOptions: {
1278
+ headerHeight: 44,
1279
+ lineHeight: 44,
1280
+ barHeight: 22
1281
+ },
1282
+ dateOptions: {
1283
+ weekStartsOn: 1
1284
+ }
1285
+ };
1286
+ const GANTT_GLOBAL_CONFIG = new InjectionToken('GANTT_GLOBAL_CONFIG');
1287
+ class GanttConfigService {
1288
+ constructor(globalConfig) {
1289
+ const localeId = globalConfig.locale || defaultConfig.locale;
1290
+ this.config = {
1291
+ locale: localeId,
1292
+ dateFormat: Object.assign({}, defaultConfig.dateFormat, globalConfig.dateFormat),
1293
+ styleOptions: Object.assign({}, defaultConfig.styleOptions, globalConfig.styleOptions),
1294
+ linkOptions: Object.assign({}, defaultConfig.linkOptions, globalConfig.linkOptions),
1295
+ dateOptions: Object.assign({}, defaultConfig.dateOptions, globalConfig.dateOptions)
1296
+ };
1297
+ this.i18nLocales = inject(GANTT_I18N_LOCALE_TOKEN).reduce((result, localeConfig) => {
1298
+ result[localeConfig.id] = localeConfig; // 这里使用 `id` 作为 key
1299
+ return result;
1300
+ }, {
1301
+ ['zh-cn']: zhHans,
1302
+ ['zh-tw']: zhHant
1303
+ });
1304
+ }
1305
+ getLocaleConfig() {
1306
+ return this.i18nLocales[this.config.locale] ?? this.i18nLocales[this.config.locale.toLowerCase()] ?? zhHans;
1307
+ }
1308
+ getViewsLocale() {
1309
+ return this.getLocaleConfig().views;
1310
+ }
1311
+ getDateLocal() {
1312
+ return this.config.dateOptions?.locale ?? this.getLocaleConfig().dateLocale;
1313
+ }
1314
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GanttConfigService, deps: [{ token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
1315
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GanttConfigService, providedIn: 'root' }); }
1316
+ }
1317
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GanttConfigService, decorators: [{
1318
+ type: Injectable,
1319
+ args: [{ providedIn: 'root' }]
1320
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
1321
+ type: Inject,
1322
+ args: [GANTT_GLOBAL_CONFIG]
1323
+ }] }] });
1324
+
999
1325
  class GanttUpper {
1000
1326
  set linkOptions(options) {
1001
1327
  this._linkOptions = options;
1002
1328
  }
1003
1329
  get linkOptions() {
1004
- return Object.assign({}, defaultConfig.linkOptions, this.config.linkOptions, this._linkOptions);
1330
+ return Object.assign({}, this.configService.config.linkOptions, this._linkOptions);
1005
1331
  }
1006
1332
  set selectable(value) {
1007
1333
  this._selectable = coerceBooleanProperty(value);
@@ -1028,7 +1354,8 @@ class GanttUpper {
1028
1354
  get element() {
1029
1355
  return this.elementRef.nativeElement;
1030
1356
  }
1031
- constructor(elementRef, cdr, ngZone, config) {
1357
+ constructor(elementRef, cdr, ngZone, // @Inject(GANTT_GLOBAL_CONFIG) public config: GanttGlobalConfig
1358
+ config) {
1032
1359
  this.elementRef = elementRef;
1033
1360
  this.cdr = cdr;
1034
1361
  this.ngZone = ngZone;
@@ -1054,6 +1381,7 @@ class GanttUpper {
1054
1381
  this.barClick = new EventEmitter();
1055
1382
  this.viewChange = new EventEmitter();
1056
1383
  this.expandChange = new EventEmitter();
1384
+ this.configService = inject(GanttConfigService);
1057
1385
  this.computeAllRefs = true;
1058
1386
  this.linkDragEnded = new EventEmitter();
1059
1387
  this.items = [];
@@ -1068,8 +1396,10 @@ class GanttUpper {
1068
1396
  }
1069
1397
  createView() {
1070
1398
  const viewDate = this.getViewDate();
1071
- this.viewOptions.dateFormat = Object.assign({}, defaultConfig.dateFormat, this.config.dateFormat, this.viewOptions.dateFormat);
1072
- this.viewOptions.styleOptions = Object.assign({}, defaultConfig.styleOptions, this.config.styleOptions, this.viewOptions.styleOptions);
1399
+ this.styles = Object.assign({}, this.configService.config.styleOptions, this.styles);
1400
+ this.viewOptions.dateFormat = Object.assign({}, this.configService.config.dateFormat, this.viewOptions.dateFormat);
1401
+ this.viewOptions.styleOptions = Object.assign({}, this.configService.config.styleOptions, this.viewOptions.styleOptions);
1402
+ this.viewOptions.dateDisplayFormats = this.configService.getViewsLocale()[this.viewType]?.dateFormats;
1073
1403
  this.view = createViewFactory(this.viewType, viewDate.start, viewDate.end, this.viewOptions);
1074
1404
  }
1075
1405
  setupGroups() {
@@ -1138,10 +1468,12 @@ class GanttUpper {
1138
1468
  if (!this.start || !this.end) {
1139
1469
  this.originItems.forEach((item) => {
1140
1470
  if (item.start && !this.start) {
1141
- start = start ? Math.min(start, item.start) : item.start;
1471
+ const itemStart = item.start instanceof Date ? item.start.getTime() / 1000 : item.start;
1472
+ start = start ? Math.min(start, itemStart) : itemStart;
1142
1473
  }
1143
1474
  if (item.end && !this.end) {
1144
- end = end ? Math.max(end, item.end) : item.end;
1475
+ const itemEnd = item.start instanceof Date ? item.start.getTime() / 1000 : item.start;
1476
+ end = end ? Math.max(end, itemEnd) : itemEnd;
1145
1477
  }
1146
1478
  });
1147
1479
  }
@@ -1177,7 +1509,6 @@ class GanttUpper {
1177
1509
  this.cdr.detectChanges();
1178
1510
  }
1179
1511
  ngOnInit() {
1180
- this.styles = Object.assign({}, defaultConfig.styleOptions, this.config.styleOptions, this.styles);
1181
1512
  this.createView();
1182
1513
  this.setupGroups();
1183
1514
  this.setupItems();
@@ -1298,15 +1629,12 @@ class GanttUpper {
1298
1629
  rerenderView() {
1299
1630
  this.changeView(this.viewType);
1300
1631
  }
1301
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GanttUpper, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: GANTT_GLOBAL_CONFIG }], target: i0.ɵɵFactoryTarget.Directive }); }
1632
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GanttUpper, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
1302
1633
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.0", type: GanttUpper, inputs: { originItems: ["items", "originItems"], originGroups: ["groups", "originGroups"], originBaselineItems: ["baselineItems", "originBaselineItems"], viewType: "viewType", start: "start", end: "end", showTodayLine: "showTodayLine", draggable: "draggable", styles: "styles", showToolbar: "showToolbar", toolbarOptions: "toolbarOptions", viewOptions: "viewOptions", linkOptions: "linkOptions", disabledLoadOnScroll: "disabledLoadOnScroll", selectable: "selectable", multiple: "multiple", quickTimeFocus: "quickTimeFocus" }, outputs: { loadOnScroll: "loadOnScroll", dragStarted: "dragStarted", dragMoved: "dragMoved", dragEnded: "dragEnded", barClick: "barClick", viewChange: "viewChange", expandChange: "expandChange" }, host: { properties: { "class.gantt": "this.ganttClass" } }, queries: [{ propertyName: "barTemplate", first: true, predicate: ["bar"], descendants: true, static: true }, { propertyName: "rangeTemplate", first: true, predicate: ["range"], descendants: true, static: true }, { propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, static: true }, { propertyName: "baselineTemplate", first: true, predicate: ["baseline"], descendants: true, static: true }, { propertyName: "groupTemplate", first: true, predicate: ["group"], descendants: true, static: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: ["groupHeader"], descendants: true, static: true }, { propertyName: "toolbarTemplate", first: true, predicate: ["toolbar"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0 }); }
1303
1634
  }
1304
1635
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GanttUpper, decorators: [{
1305
1636
  type: Directive
1306
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
1307
- type: Inject,
1308
- args: [GANTT_GLOBAL_CONFIG]
1309
- }] }], propDecorators: { originItems: [{
1637
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined }], propDecorators: { originItems: [{
1310
1638
  type: Input,
1311
1639
  args: ['items']
1312
1640
  }], originGroups: [{
@@ -1773,8 +2101,8 @@ class GanttBarDrag {
1773
2101
  createMouseEvents() {
1774
2102
  if (!this.hasMonitorMouseEvent && (!this.dragDisabled || !this.linkDragDisabled)) {
1775
2103
  this.hasMonitorMouseEvent = true;
1776
- const dropClass = this.ganttUpper.config.linkOptions?.dependencyTypes?.length === 1 &&
1777
- this.ganttUpper.config.linkOptions?.dependencyTypes[0] === GanttLinkType.fs
2104
+ const dropClass = this.ganttUpper.linkOptions?.dependencyTypes?.length === 1 &&
2105
+ this.ganttUpper.linkOptions?.dependencyTypes[0] === GanttLinkType.fs
1778
2106
  ? singleDropActiveClass
1779
2107
  : dropActiveClass;
1780
2108
  fromEvent(this.barElement, 'mouseenter', passiveListenerOptions)
@@ -3163,6 +3491,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
3163
3491
  standalone: true
3164
3492
  }]
3165
3493
  }] });
3494
+ class GanttDateFormatPipe {
3495
+ transform(value, format) {
3496
+ return new GanttDate(value).format(format);
3497
+ }
3498
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GanttDateFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
3499
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: GanttDateFormatPipe, isStandalone: true, name: "dateFormat" }); }
3500
+ }
3501
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: GanttDateFormatPipe, decorators: [{
3502
+ type: Pipe,
3503
+ args: [{
3504
+ name: 'dateFormat',
3505
+ standalone: true
3506
+ }]
3507
+ }] });
3166
3508
 
3167
3509
  class NgxGanttRangeComponent extends GanttItemUpper {
3168
3510
  constructor(elementRef, ganttUpper) {
@@ -3749,17 +4091,17 @@ class NgxGanttToolbarComponent {
3749
4091
  constructor(ganttUpper) {
3750
4092
  this.ganttUpper = ganttUpper;
3751
4093
  this.ganttItemClass = true;
3752
- this.ganttViewsMap = keyBy(ganttViews, 'value');
4094
+ this.views = inject(GanttConfigService).getViewsLocale();
3753
4095
  }
3754
4096
  selectView(view) {
3755
4097
  this.ganttUpper.changeView(view);
3756
4098
  }
3757
4099
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgxGanttToolbarComponent, deps: [{ token: GANTT_UPPER_TOKEN }], target: i0.ɵɵFactoryTarget.Component }); }
3758
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", 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 <ng-container *ngIf=\"!template\">\n <div class=\"toolbar-views\" *ngIf=\"this.ganttUpper.toolbarOptions?.viewTypes?.length\">\n <ng-container *ngFor=\"let view of this.ganttUpper.toolbarOptions?.viewTypes\">\n <div class=\"toolbar-view\" *ngIf=\"ganttViewsMap[view]\" [class.active]=\"view === this.ganttUpper.viewType\" (click)=\"selectView(view)\">\n {{ ganttViewsMap[view].name }}\n </div>\n </ng-container>\n </div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
4100
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.0", 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 <ng-container *ngIf=\"!template\">\n <div class=\"toolbar-views\" *ngIf=\"this.ganttUpper.toolbarOptions?.viewTypes?.length\">\n <ng-container *ngFor=\"let viewType of this.ganttUpper.toolbarOptions?.viewTypes\">\n <div\n class=\"toolbar-view\"\n *ngIf=\"views[viewType]\"\n [class.active]=\"viewType === this.ganttUpper.viewType\"\n (click)=\"selectView(viewType)\"\n >\n {{ views[viewType].label }}\n </div>\n </ng-container>\n </div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
3759
4101
  }
3760
4102
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgxGanttToolbarComponent, decorators: [{
3761
4103
  type: Component,
3762
- args: [{ selector: 'ngx-gantt-toolbar,gantt-toolbar', standalone: true, imports: [NgIf, NgFor, NgTemplateOutlet], template: "<div class=\"toolbar-container\">\n <ng-container *ngIf=\"!template\">\n <div class=\"toolbar-views\" *ngIf=\"this.ganttUpper.toolbarOptions?.viewTypes?.length\">\n <ng-container *ngFor=\"let view of this.ganttUpper.toolbarOptions?.viewTypes\">\n <div class=\"toolbar-view\" *ngIf=\"ganttViewsMap[view]\" [class.active]=\"view === this.ganttUpper.viewType\" (click)=\"selectView(view)\">\n {{ ganttViewsMap[view].name }}\n </div>\n </ng-container>\n </div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\n" }]
4104
+ args: [{ selector: 'ngx-gantt-toolbar,gantt-toolbar', standalone: true, imports: [NgIf, NgFor, NgTemplateOutlet], template: "<div class=\"toolbar-container\">\n <ng-container *ngIf=\"!template\">\n <div class=\"toolbar-views\" *ngIf=\"this.ganttUpper.toolbarOptions?.viewTypes?.length\">\n <ng-container *ngFor=\"let viewType of this.ganttUpper.toolbarOptions?.viewTypes\">\n <div\n class=\"toolbar-view\"\n *ngIf=\"views[viewType]\"\n [class.active]=\"viewType === this.ganttUpper.viewType\"\n (click)=\"selectView(viewType)\"\n >\n {{ views[viewType].label }}\n </div>\n </ng-container>\n </div>\n </ng-container>\n <ng-template [ngTemplateOutlet]=\"template\"></ng-template>\n</div>\n" }]
3763
4105
  }], ctorParameters: () => [{ type: GanttUpper, decorators: [{
3764
4106
  type: Inject,
3765
4107
  args: [GANTT_UPPER_TOKEN]
@@ -3975,7 +4317,7 @@ class NgxGanttRootComponent {
3975
4317
  }
3976
4318
  scrollToDate(date) {
3977
4319
  let x;
3978
- if (typeof date === 'number') {
4320
+ if (typeof date === 'number' || date instanceof Date) {
3979
4321
  x = this.view.getXPointByDate(new GanttDate(date));
3980
4322
  }
3981
4323
  else {
@@ -4470,13 +4812,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
4470
4812
  }] } });
4471
4813
 
4472
4814
  class NgxGanttModule {
4473
- constructor(ganttGlobalConfig) {
4815
+ constructor() {
4816
+ const configService = inject(GanttConfigService);
4474
4817
  setDefaultOptions({
4475
- locale: ganttGlobalConfig?.dateOptions?.locale,
4476
- weekStartsOn: ganttGlobalConfig?.dateOptions?.weekStartsOn || 1
4818
+ locale: configService.getDateLocal(),
4819
+ weekStartsOn: configService.config?.dateOptions?.weekStartsOn
4477
4820
  });
4821
+ if (configService.config.dateOptions?.timeZone) {
4822
+ setDefaultTimeZone$1(configService.config.dateOptions.timeZone);
4823
+ }
4478
4824
  }
4479
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgxGanttModule, deps: [{ token: GANTT_GLOBAL_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
4825
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgxGanttModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
4480
4826
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: NgxGanttModule, imports: [CommonModule,
4481
4827
  DragDropModule,
4482
4828
  ScrollingModule,
@@ -4500,7 +4846,8 @@ class NgxGanttModule {
4500
4846
  GanttScrollbarComponent,
4501
4847
  IsGanttRangeItemPipe,
4502
4848
  IsGanttBarItemPipe,
4503
- IsGanttCustomItemPipe], exports: [NgxGanttComponent,
4849
+ IsGanttCustomItemPipe,
4850
+ GanttDateFormatPipe], exports: [NgxGanttComponent,
4504
4851
  NgxGanttTableComponent,
4505
4852
  NgxGanttTableColumnComponent,
4506
4853
  NgxGanttRootComponent,
@@ -4511,13 +4858,15 @@ class NgxGanttModule {
4511
4858
  GanttCalendarHeaderComponent,
4512
4859
  GanttCalendarGridComponent,
4513
4860
  GanttDragBackdropComponent,
4514
- GanttScrollbarComponent] }); }
4861
+ GanttScrollbarComponent,
4862
+ GanttDateFormatPipe] }); }
4515
4863
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NgxGanttModule, providers: [
4516
4864
  CdkVirtualScrollViewport,
4517
4865
  {
4518
4866
  provide: GANTT_GLOBAL_CONFIG,
4519
4867
  useValue: defaultConfig
4520
- }
4868
+ },
4869
+ ...i18nLocaleProvides
4521
4870
  ], imports: [CommonModule,
4522
4871
  DragDropModule,
4523
4872
  ScrollingModule,
@@ -4550,7 +4899,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
4550
4899
  GanttScrollbarComponent,
4551
4900
  IsGanttRangeItemPipe,
4552
4901
  IsGanttBarItemPipe,
4553
- IsGanttCustomItemPipe
4902
+ IsGanttCustomItemPipe,
4903
+ GanttDateFormatPipe
4554
4904
  ],
4555
4905
  exports: [
4556
4906
  NgxGanttComponent,
@@ -4564,22 +4914,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
4564
4914
  GanttCalendarHeaderComponent,
4565
4915
  GanttCalendarGridComponent,
4566
4916
  GanttDragBackdropComponent,
4567
- GanttScrollbarComponent
4917
+ GanttScrollbarComponent,
4918
+ GanttDateFormatPipe
4568
4919
  ],
4569
4920
  providers: [
4570
4921
  CdkVirtualScrollViewport,
4571
4922
  {
4572
4923
  provide: GANTT_GLOBAL_CONFIG,
4573
4924
  useValue: defaultConfig
4574
- }
4925
+ },
4926
+ ...i18nLocaleProvides
4575
4927
  ]
4576
4928
  }]
4577
- }], ctorParameters: () => [{ type: undefined, decorators: [{
4578
- type: Optional
4579
- }, {
4580
- type: Inject,
4581
- args: [GANTT_GLOBAL_CONFIG]
4582
- }] }] });
4929
+ }], ctorParameters: () => [] });
4583
4930
 
4584
4931
  /*
4585
4932
  * Public API Surface of gantt
@@ -4589,5 +4936,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
4589
4936
  * Generated bundle index. Do not edit.
4590
4937
  */
4591
4938
 
4592
- export { GANTT_GLOBAL_CONFIG, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttBaselineItemInternal, GanttCalendarGridComponent, GanttCalendarHeaderComponent, GanttDate, GanttDatePoint, GanttDragBackdropComponent, GanttDragEvent, GanttGroupInternal, GanttItemInternal, GanttItemType, GanttItemUpper, GanttLineClickEvent, GanttLinkDragEvent, GanttLinkLineType, GanttLinkType, GanttLoadOnScrollEvent, GanttLoaderComponent, GanttPrintService, GanttScrollbarComponent, GanttSelectedEvent, GanttTableDragDroppedEvent, GanttTableDragEndedEvent, GanttTableDragEnterPredicateContext, GanttTableDragStartedEvent, GanttTableEvent, GanttTableItemClickEvent, GanttUpper, GanttView, GanttViewType, GanttVirtualScrolledIndexChangeEvent, IsGanttBarItemPipe, IsGanttCustomItemPipe, IsGanttRangeItemPipe, LinkColors, NgxGanttBarComponent, NgxGanttBaselineComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, NgxGanttToolbarComponent, defaultConfig, ganttViews, primaryDatePointTop, registerView, secondaryDatePointTop };
4939
+ export { GANTT_GLOBAL_CONFIG, GANTT_I18N_LOCALE_TOKEN, GANTT_UPPER_TOKEN, GanttBarClickEvent, GanttBaselineItemInternal, GanttCalendarGridComponent, GanttCalendarHeaderComponent, GanttConfigService, GanttDate, GanttDateFormatPipe, 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, IsGanttRangeItemPipe, LinkColors, NgxGanttBarComponent, NgxGanttBaselineComponent, NgxGanttComponent, NgxGanttModule, NgxGanttRangeComponent, NgxGanttRootComponent, NgxGanttTableColumnComponent, NgxGanttTableComponent, NgxGanttToolbarComponent, deDeLocale, defaultConfig, enUsLocale, jaJpLocale, primaryDatePointTop, registerView, ruRuLocale, secondaryDatePointTop, setDefaultTimeZone, zhHans as zhHansLocale, zhHant as zhHantLocale };
4593
4940
  //# sourceMappingURL=worktile-gantt.mjs.map