Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
providers: [{
provide: CalendarDateFormatter,
useClass: SchedulerDateFormatter
}]
})
export class AppComponent implements OnInit {
title = 'Angular Calendar Scheduler Demo';
CalendarView = CalendarView;
view: CalendarView = CalendarView.Week;
viewDate: Date = new Date();
refresh: Subject = new Subject();
locale: string = 'en';
weekStartsOn: number = 1;
startsWithToday: boolean = true;
activeDayIsOpen: boolean = true;
excludeDays: number[] = []; // [0];
dayStartHour: number = 6;
dayEndHour: number = 22;
minDate: Date = new Date();
maxDate: Date = endOfDay(addMonths(new Date(), 1));
dayModifier: Function;
hourModifier: Function;
segmentModifier: Function;
eventModifier: Function;
import { Subject } from 'rxjs';
import { addDays } from 'date-fns';
import {
CalendarEvent,
CalendarEventTimesChangedEvent,
CalendarView
} from 'angular-calendar';
import { colors } from '../demo-utils/colors';
@Component({
selector: 'mwl-demo-component',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: 'template.html'
})
export class DemoComponent {
view: CalendarView = CalendarView.Week;
viewDate: Date = new Date();
events: CalendarEvent[] = [
{
title: 'Resizable event',
color: colors.yellow,
start: new Date(),
end: addDays(new Date(), 1), // an end date is always required for resizable events to work
resizable: {
beforeStart: true, // this allows you to configure the sides the event is resizable from
afterEnd: true
}
},
{
title: 'A non resizable event',
ChangeDetectionStrategy,
OnDestroy,
ChangeDetectorRef
} from '@angular/core';
import { BreakpointObserver, BreakpointState } from '@angular/cdk/layout';
import { CalendarView } from 'angular-calendar';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@Component({
selector: 'mwl-demo-component',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './template.html'
})
export class DemoComponent implements OnInit, OnDestroy {
view: CalendarView = CalendarView.Week;
viewDate: Date = new Date();
daysInWeek = 7;
private destroy$ = new Subject();
constructor(
private breakpointObserver: BreakpointObserver,
private cd: ChangeDetectorRef
) {}
ngOnInit() {
const CALENDAR_RESPONSIVE = {
small: {
breakpoint: '(max-width: 576px)',
setView(view: RunboxCalendarView): void {
this.view = view;
this.settings.lastUsedView = this.view;
localStorage.setItem('calendarSettings', JSON.stringify(this.settings));
switch (this.view) {
case RunboxCalendarView.Overview: {
this.mwlView = null;
break;
}
case RunboxCalendarView.Month: {
this.mwlView = CalendarView.Month;
break;
}
case RunboxCalendarView.Week: {
this.mwlView = CalendarView.Week;
break;
}
case RunboxCalendarView.Day: {
this.mwlView = CalendarView.Day;
break;
}
}
}