fullcalendar.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. "use strict";
  2. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7. };
  8. var __metadata = (this && this.__metadata) || function (k, v) {
  9. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  10. };
  11. Object.defineProperty(exports, "__esModule", { value: true });
  12. var core_1 = require("@angular/core");
  13. var common_1 = require("@angular/common");
  14. var core_2 = require("@fullcalendar/core");
  15. var FullCalendar = /** @class */ (function () {
  16. function FullCalendar(el) {
  17. this.el = el;
  18. }
  19. FullCalendar.prototype.ngOnInit = function () {
  20. this.config = {
  21. theme: true
  22. };
  23. if (this.options) {
  24. for (var prop in this.options) {
  25. this.config[prop] = this.options[prop];
  26. }
  27. }
  28. };
  29. FullCalendar.prototype.ngAfterViewChecked = function () {
  30. if (!this.initialized && this.el.nativeElement.offsetParent) {
  31. this.initialize();
  32. }
  33. };
  34. Object.defineProperty(FullCalendar.prototype, "events", {
  35. get: function () {
  36. return this._events;
  37. },
  38. set: function (value) {
  39. this._events = value;
  40. if (this._events && this.calendar) {
  41. this.calendar.removeAllEventSources();
  42. this.calendar.addEventSource(this._events);
  43. }
  44. },
  45. enumerable: true,
  46. configurable: true
  47. });
  48. Object.defineProperty(FullCalendar.prototype, "options", {
  49. get: function () {
  50. return this._options;
  51. },
  52. set: function (value) {
  53. this._options = value;
  54. if (this._options && this.calendar) {
  55. for (var prop in this._options) {
  56. var optionValue = this._options[prop];
  57. this.config[prop] = optionValue;
  58. this.calendar.setOption(prop, optionValue);
  59. }
  60. }
  61. },
  62. enumerable: true,
  63. configurable: true
  64. });
  65. FullCalendar.prototype.initialize = function () {
  66. this.calendar = new core_2.Calendar(this.el.nativeElement.children[0], this.config);
  67. this.calendar.render();
  68. this.initialized = true;
  69. if (this.events) {
  70. this.calendar.removeAllEventSources();
  71. this.calendar.addEventSource(this.events);
  72. }
  73. };
  74. FullCalendar.prototype.getCalendar = function () {
  75. return this.calendar;
  76. };
  77. FullCalendar.prototype.ngOnDestroy = function () {
  78. if (this.calendar) {
  79. this.calendar.destroy();
  80. this.initialized = false;
  81. this.calendar = null;
  82. }
  83. };
  84. __decorate([
  85. core_1.Input(),
  86. __metadata("design:type", Object)
  87. ], FullCalendar.prototype, "style", void 0);
  88. __decorate([
  89. core_1.Input(),
  90. __metadata("design:type", String)
  91. ], FullCalendar.prototype, "styleClass", void 0);
  92. __decorate([
  93. core_1.Input(),
  94. __metadata("design:type", Object),
  95. __metadata("design:paramtypes", [Object])
  96. ], FullCalendar.prototype, "events", null);
  97. __decorate([
  98. core_1.Input(),
  99. __metadata("design:type", Object),
  100. __metadata("design:paramtypes", [Object])
  101. ], FullCalendar.prototype, "options", null);
  102. FullCalendar = __decorate([
  103. core_1.Component({
  104. selector: 'p-fullCalendar',
  105. template: '<div [ngStyle]="style" [class]="styleClass"></div>'
  106. }),
  107. __metadata("design:paramtypes", [core_1.ElementRef])
  108. ], FullCalendar);
  109. return FullCalendar;
  110. }());
  111. exports.FullCalendar = FullCalendar;
  112. var FullCalendarModule = /** @class */ (function () {
  113. function FullCalendarModule() {
  114. }
  115. FullCalendarModule = __decorate([
  116. core_1.NgModule({
  117. imports: [common_1.CommonModule],
  118. exports: [FullCalendar],
  119. declarations: [FullCalendar]
  120. })
  121. ], FullCalendarModule);
  122. return FullCalendarModule;
  123. }());
  124. exports.FullCalendarModule = FullCalendarModule;
  125. //# sourceMappingURL=fullcalendar.js.map