@@ -2,6 +2,7 @@ import { AfterViewInit, Component, HostBinding, OnInit, ViewChild } from '@angul
22import {
33 GanttBarClickEvent ,
44 GanttBaselineItem ,
5+ GanttDate ,
56 GanttDragEvent ,
67 GanttItem ,
78 GanttLineClickEvent ,
@@ -15,6 +16,7 @@ import {
1516 GanttTableItemClickEvent ,
1617 GanttToolbarOptions ,
1718 GanttView ,
19+ GanttViewOptions ,
1820 GanttViewType ,
1921 NgxGanttComponent
2022} from 'ngx-gantt' ;
@@ -44,24 +46,26 @@ export class AppGanttExampleComponent implements OnInit, AfterViewInit {
4446 ]
4547 } ;
4648
47- viewType : GanttViewType = GanttViewType . month ;
49+ viewType : GanttViewType = GanttViewType . day ;
4850
49- selectedViewType : GanttViewType = GanttViewType . month ;
51+ selectedViewType : GanttViewType = GanttViewType . day ;
5052
5153 isBaselineChecked = false ;
5254
5355 isShowToolbarChecked = true ;
5456
5557 loading = false ;
5658
59+ isHideHolidayChecked = false ;
60+
5761 items : GanttItem [ ] = [
5862 { id : '000000' , title : 'Task 0' , start : 1627729997 , end : 1627769997 , draggable : false , linkable : false } ,
5963 // { id: '000001', title: 'Task 1', start: 1617361997, end: 1625483597, links: ['000003', '000004', '000000'], },
6064 { id : '000001' , title : 'Task 1' , start : 1617361997 , end : 1625483597 , links : [ '000003' , '000004' , '0000029' ] , draggable : false } ,
6165 { id : '000002' , title : 'Task 2' , start : 1617361997 , end : 1625483597 , progress : 0.5 , linkable : false } ,
6266 { id : '000003' , title : 'Task 3 (不可拖动)' , start : 1628507597 , end : 1633345997 , itemDraggable : false } ,
6367 { id : '000004' , title : 'Task 4' , start : 1624705997 } ,
64- { id : '000005' , title : 'Task 5' , start : 1628075597 , end : 1629544397 , color : '#709dc1' } ,
68+ { id : '000005' , title : 'Task 5' , start : 1756628881 , end : 1756801681 , color : '#709dc1' } ,
6569 { id : '000006' , title : 'Task 6' , start : 1641121997 , end : 1645528397 } ,
6670 { id : '000007' , title : 'Task 7' , start : 1639393997 , end : 1640862797 } ,
6771 { id : '000008' , title : 'Task 8' , end : 1628783999 , color : '#709dc1' } ,
@@ -94,7 +98,12 @@ export class AppGanttExampleComponent implements OnInit, AfterViewInit {
9498 viewType : GanttViewType . day
9599 } ;
96100
97- viewOptions = { } ;
101+ viewOptions : GanttViewOptions = {
102+ hoilday : {
103+ isHoliday : ( date : GanttDate ) => date . isWeekend ( ) ,
104+ hideHoliday : false
105+ }
106+ } ;
98107
99108 width = JSON . parse ( localStorage . getItem ( cacheKeys ) ) ;
100109
@@ -231,4 +240,14 @@ export class AppGanttExampleComponent implements OnInit, AfterViewInit {
231240 this . width = width ;
232241 localStorage . setItem ( cacheKeys , JSON . stringify ( width ) ) ;
233242 }
243+
244+ holidayChange ( ) {
245+ this . viewOptions = {
246+ ...this . viewOptions ,
247+ hoilday : {
248+ ...this . viewOptions . hoilday ,
249+ hideHoliday : this . isHideHolidayChecked
250+ }
251+ } ;
252+ }
234253}
0 commit comments