[59329aa] | 1 | import * as i0 from '@angular/core';
|
---|
| 2 | import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, NgModule } from '@angular/core';
|
---|
| 3 | import * as i1 from '@angular/common';
|
---|
| 4 | import { CommonModule } from '@angular/common';
|
---|
| 5 | import { Calendar } from '@fullcalendar/core';
|
---|
| 6 |
|
---|
| 7 | class FullCalendar {
|
---|
| 8 | constructor(el) {
|
---|
| 9 | this.el = el;
|
---|
| 10 | }
|
---|
| 11 | ngOnInit() {
|
---|
| 12 | this.config = {
|
---|
| 13 | theme: true
|
---|
| 14 | };
|
---|
| 15 | if (this.options) {
|
---|
| 16 | for (let prop in this.options) {
|
---|
| 17 | this.config[prop] = this.options[prop];
|
---|
| 18 | }
|
---|
| 19 | }
|
---|
| 20 | }
|
---|
| 21 | ngAfterViewChecked() {
|
---|
| 22 | if (!this.initialized && this.el.nativeElement.offsetParent) {
|
---|
| 23 | this.initialize();
|
---|
| 24 | }
|
---|
| 25 | }
|
---|
| 26 | get events() {
|
---|
| 27 | return this._events;
|
---|
| 28 | }
|
---|
| 29 | set events(value) {
|
---|
| 30 | this._events = value;
|
---|
| 31 | if (this._events && this.calendar) {
|
---|
| 32 | this.calendar.removeAllEventSources();
|
---|
| 33 | this.calendar.addEventSource(this._events);
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
| 36 | get options() {
|
---|
| 37 | return this._options;
|
---|
| 38 | }
|
---|
| 39 | set options(value) {
|
---|
| 40 | this._options = value;
|
---|
| 41 | if (this._options && this.calendar) {
|
---|
| 42 | for (let prop in this._options) {
|
---|
| 43 | let optionValue = this._options[prop];
|
---|
| 44 | this.config[prop] = optionValue;
|
---|
| 45 | this.calendar.setOption(prop, optionValue);
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
| 49 | initialize() {
|
---|
| 50 | this.calendar = new Calendar(this.el.nativeElement.children[0], this.config);
|
---|
| 51 | this.calendar.render();
|
---|
| 52 | this.initialized = true;
|
---|
| 53 | if (this.events) {
|
---|
| 54 | this.calendar.removeAllEventSources();
|
---|
| 55 | this.calendar.addEventSource(this.events);
|
---|
| 56 | }
|
---|
| 57 | }
|
---|
| 58 | getCalendar() {
|
---|
| 59 | return this.calendar;
|
---|
| 60 | }
|
---|
| 61 | ngOnDestroy() {
|
---|
| 62 | if (this.calendar) {
|
---|
| 63 | this.calendar.destroy();
|
---|
| 64 | this.initialized = false;
|
---|
| 65 | this.calendar = null;
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
| 68 | }
|
---|
| 69 | FullCalendar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: FullCalendar, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
---|
| 70 | FullCalendar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: FullCalendar, selector: "p-fullCalendar", inputs: { style: "style", styleClass: "styleClass", events: "events", options: "options" }, host: { classAttribute: "p-element" }, ngImport: i0, template: '<div [ngStyle]="style" [class]="styleClass"></div>', isInline: true, directives: [{ type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
| 71 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: FullCalendar, decorators: [{
|
---|
| 72 | type: Component,
|
---|
| 73 | args: [{
|
---|
| 74 | selector: 'p-fullCalendar',
|
---|
| 75 | template: '<div [ngStyle]="style" [class]="styleClass"></div>',
|
---|
| 76 | changeDetection: ChangeDetectionStrategy.OnPush,
|
---|
| 77 | encapsulation: ViewEncapsulation.None,
|
---|
| 78 | host: {
|
---|
| 79 | 'class': 'p-element'
|
---|
| 80 | }
|
---|
| 81 | }]
|
---|
| 82 | }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { style: [{
|
---|
| 83 | type: Input
|
---|
| 84 | }], styleClass: [{
|
---|
| 85 | type: Input
|
---|
| 86 | }], events: [{
|
---|
| 87 | type: Input
|
---|
| 88 | }], options: [{
|
---|
| 89 | type: Input
|
---|
| 90 | }] } });
|
---|
| 91 | class FullCalendarModule {
|
---|
| 92 | }
|
---|
| 93 | FullCalendarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: FullCalendarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
| 94 | FullCalendarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: FullCalendarModule, declarations: [FullCalendar], imports: [CommonModule], exports: [FullCalendar] });
|
---|
| 95 | FullCalendarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: FullCalendarModule, imports: [[CommonModule]] });
|
---|
| 96 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: FullCalendarModule, decorators: [{
|
---|
| 97 | type: NgModule,
|
---|
| 98 | args: [{
|
---|
| 99 | imports: [CommonModule],
|
---|
| 100 | exports: [FullCalendar],
|
---|
| 101 | declarations: [FullCalendar]
|
---|
| 102 | }]
|
---|
| 103 | }] });
|
---|
| 104 |
|
---|
| 105 | /**
|
---|
| 106 | * Generated bundle index. Do not edit.
|
---|
| 107 | */
|
---|
| 108 |
|
---|
| 109 | export { FullCalendar, FullCalendarModule };
|
---|