Last active
March 9, 2021 06:47
-
-
Save AilisObrian/36f89e3d97a5d736ebf30d217effae2c to your computer and use it in GitHub Desktop.
PrimeNG's Schedule Component refactored for overriding FullCalendar's configs @ ngOnInit().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Component, | |
ElementRef, | |
IterableDiffers, | |
OnInit, | |
Input, | |
Output, | |
EventEmitter, | |
} from '@angular/core'; | |
import { Schedule } from 'primeng/primeng'; | |
@Component({ | |
selector: 'p-schedule-custom', // tslint:disable-line | |
template: ` | |
<div [ngStyle]="style" [class]="styleClass"></div> | |
`, | |
}) | |
export class CustomScheduleComponent extends Schedule implements OnInit { | |
@Input() resources: any[]; // XXX [obrian]: Add this for fullcalendar.io/scheduler | |
// XXX: Copied ---- START! | |
// https://github.com/primefaces/primeng/blob/637bb4558e5db5b5118c72539ab672fe6e4f195f/components/schedule/schedule.ts#L14-L108 | |
/* tslint:disable */ | |
@Input() events: any[]; | |
@Input() header: any; | |
@Input() style: any; | |
@Input() styleClass: string; | |
@Input() rtl: boolean; | |
@Input() weekends: boolean; | |
@Input() hiddenDays: number[]; | |
@Input() fixedWeekCount: boolean; | |
@Input() weekNumbers: boolean; | |
@Input() businessHours: any; | |
@Input() height: any; | |
@Input() contentHeight: any; | |
@Input() aspectRatio: number = 1.35; | |
@Input() eventLimit: any; | |
@Input() defaultDate: any; | |
@Input() editable: boolean; | |
@Input() eventStartEditable: boolean; | |
@Input() eventDurationEditable: boolean; | |
@Input() defaultView: string = 'month'; | |
@Input() allDaySlot: boolean = true; | |
@Input() allDayText: string = 'all-day'; | |
@Input() slotDuration: any = '00:30:00'; | |
@Input() slotLabelInterval: any; | |
@Input() snapDuration: any; | |
@Input() scrollTime: any = '06:00:00'; | |
@Input() minTime: any = '00:00:00'; | |
@Input() maxTime: any = '24:00:00'; | |
@Input() slotEventOverlap: boolean = true; | |
@Input() nowIndicator: boolean; | |
@Input() dragRevertDuration: number = 500; | |
@Input() dragOpacity: number = .75; | |
@Input() dragScroll: boolean = true; | |
@Input() eventOverlap: any; | |
@Input() eventConstraint: any; | |
@Input() locale: any; | |
@Input() eventRender: Function; | |
@Input() dayRender: Function; | |
@Output() onDayClick: EventEmitter<any> = new EventEmitter(); | |
@Output() onEventClick: EventEmitter<any> = new EventEmitter(); | |
@Output() onEventMouseover: EventEmitter<any> = new EventEmitter(); | |
@Output() onEventMouseout: EventEmitter<any> = new EventEmitter(); | |
@Output() onEventDragStart: EventEmitter<any> = new EventEmitter(); | |
@Output() onEventDragStop: EventEmitter<any> = new EventEmitter(); | |
@Output() onEventDrop: EventEmitter<any> = new EventEmitter(); | |
@Output() onEventResizeStart: EventEmitter<any> = new EventEmitter(); | |
@Output() onEventResizeStop: EventEmitter<any> = new EventEmitter(); | |
@Output() onEventResize: EventEmitter<any> = new EventEmitter(); | |
@Output() viewRender: EventEmitter<any> = new EventEmitter(); | |
/* tslint:enable */ | |
// XXX: Copied ---- END! | |
constructor(public el: ElementRef, differs: IterableDiffers) { | |
super(el, differs); | |
} | |
ngOnInit() { | |
super.ngOnInit(); | |
this.options.resources = this.resources; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment