@fullcalendar/core 5.10.1 → 6.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/main.cjs.js CHANGED
@@ -1,74 +1,66 @@
1
1
  /*!
2
- FullCalendar v5.10.1
2
+ FullCalendar v6.0.0-beta.1
3
3
  Docs & License: https://fullcalendar.io/
4
- (c) 2021 Adam Shaw
4
+ (c) 2022 Adam Shaw
5
5
  */
6
6
  'use strict';
7
7
 
8
8
  Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
10
  require('./vdom.cjs');
11
- var tslib = require('tslib');
12
11
  var common = require('@fullcalendar/common');
13
12
 
14
- var Calendar = /** @class */ (function (_super) {
15
- tslib.__extends(Calendar, _super);
16
- function Calendar(el, optionOverrides) {
17
- if (optionOverrides === void 0) { optionOverrides = {}; }
18
- var _this = _super.call(this) || this;
19
- _this.isRendering = false;
20
- _this.isRendered = false;
21
- _this.currentClassNames = [];
22
- _this.customContentRenderId = 0; // will affect custom generated classNames?
23
- _this.handleAction = function (action) {
13
+ class Calendar extends common.CalendarApi {
14
+ constructor(el, optionOverrides = {}) {
15
+ super();
16
+ this.isRendering = false;
17
+ this.isRendered = false;
18
+ this.currentClassNames = [];
19
+ this.customContentRenderId = 0; // will affect custom generated classNames?
20
+ this.handleAction = (action) => {
24
21
  // actions we know we want to render immediately
25
22
  switch (action.type) {
26
23
  case 'SET_EVENT_DRAG':
27
24
  case 'SET_EVENT_RESIZE':
28
- _this.renderRunner.tryDrain();
25
+ this.renderRunner.tryDrain();
29
26
  }
30
27
  };
31
- _this.handleData = function (data) {
32
- _this.currentData = data;
33
- _this.renderRunner.request(data.calendarOptions.rerenderDelay);
28
+ this.handleData = (data) => {
29
+ this.currentData = data;
30
+ this.renderRunner.request(data.calendarOptions.rerenderDelay);
34
31
  };
35
- _this.handleRenderRequest = function () {
36
- if (_this.isRendering) {
37
- _this.isRendered = true;
38
- var currentData_1 = _this.currentData;
39
- common.render(common.createElement(common.CalendarRoot, { options: currentData_1.calendarOptions, theme: currentData_1.theme, emitter: currentData_1.emitter }, function (classNames, height, isHeightAuto, forPrint) {
40
- _this.setClassNames(classNames);
41
- _this.setHeight(height);
42
- return (common.createElement(common.CustomContentRenderContext.Provider, { value: _this.customContentRenderId },
43
- common.createElement(common.CalendarContent, tslib.__assign({ isHeightAuto: isHeightAuto, forPrint: forPrint }, currentData_1))));
44
- }), _this.el);
32
+ this.handleRenderRequest = () => {
33
+ if (this.isRendering) {
34
+ this.isRendered = true;
35
+ let { currentData } = this;
36
+ common.flushSync(() => {
37
+ common.render(common.createElement(common.CalendarRoot, { options: currentData.calendarOptions, theme: currentData.theme, emitter: currentData.emitter }, (classNames, height, isHeightAuto, forPrint) => {
38
+ this.setClassNames(classNames);
39
+ this.setHeight(height);
40
+ return (common.createElement(common.CustomContentRenderContext.Provider, { value: this.customContentRenderId },
41
+ common.createElement(common.CalendarContent, Object.assign({ isHeightAuto: isHeightAuto, forPrint: forPrint }, currentData))));
42
+ }), this.el);
43
+ });
45
44
  }
46
- else if (_this.isRendered) {
47
- _this.isRendered = false;
48
- common.unmountComponentAtNode(_this.el);
49
- _this.setClassNames([]);
50
- _this.setHeight('');
45
+ else if (this.isRendered) {
46
+ this.isRendered = false;
47
+ common.unmountComponentAtNode(this.el);
48
+ this.setClassNames([]);
49
+ this.setHeight('');
51
50
  }
52
- common.flushToDom();
53
51
  };
54
- _this.el = el;
55
- _this.renderRunner = new common.DelayedRunner(_this.handleRenderRequest);
52
+ this.el = el;
53
+ this.renderRunner = new common.DelayedRunner(this.handleRenderRequest);
56
54
  new common.CalendarDataManager({
57
- optionOverrides: optionOverrides,
58
- calendarApi: _this,
59
- onAction: _this.handleAction,
60
- onData: _this.handleData,
55
+ optionOverrides,
56
+ calendarApi: this,
57
+ onAction: this.handleAction,
58
+ onData: this.handleData,
61
59
  });
62
- return _this;
63
60
  }
64
- Object.defineProperty(Calendar.prototype, "view", {
65
- get: function () { return this.currentData.viewApi; } // for public API
66
- ,
67
- enumerable: false,
68
- configurable: true
69
- });
70
- Calendar.prototype.render = function () {
71
- var wasRendering = this.isRendering;
61
+ get view() { return this.currentData.viewApi; } // for public API
62
+ render() {
63
+ let wasRendering = this.isRendering;
72
64
  if (!wasRendering) {
73
65
  this.isRendering = true;
74
66
  }
@@ -79,50 +71,48 @@ var Calendar = /** @class */ (function (_super) {
79
71
  if (wasRendering) {
80
72
  this.updateSize();
81
73
  }
82
- };
83
- Calendar.prototype.destroy = function () {
74
+ }
75
+ destroy() {
84
76
  if (this.isRendering) {
85
77
  this.isRendering = false;
86
78
  this.renderRunner.request();
87
79
  }
88
- };
89
- Calendar.prototype.updateSize = function () {
90
- _super.prototype.updateSize.call(this);
91
- common.flushToDom();
92
- };
93
- Calendar.prototype.batchRendering = function (func) {
80
+ }
81
+ updateSize() {
82
+ common.flushSync(() => {
83
+ super.updateSize();
84
+ });
85
+ }
86
+ batchRendering(func) {
94
87
  this.renderRunner.pause('batchRendering');
95
88
  func();
96
89
  this.renderRunner.resume('batchRendering');
97
- };
98
- Calendar.prototype.pauseRendering = function () {
90
+ }
91
+ pauseRendering() {
99
92
  this.renderRunner.pause('pauseRendering');
100
- };
101
- Calendar.prototype.resumeRendering = function () {
93
+ }
94
+ resumeRendering() {
102
95
  this.renderRunner.resume('pauseRendering', true);
103
- };
104
- Calendar.prototype.resetOptions = function (optionOverrides, append) {
96
+ }
97
+ resetOptions(optionOverrides, append) {
105
98
  this.currentDataManager.resetOptions(optionOverrides, append);
106
- };
107
- Calendar.prototype.setClassNames = function (classNames) {
99
+ }
100
+ setClassNames(classNames) {
108
101
  if (!common.isArraysEqual(classNames, this.currentClassNames)) {
109
- var classList = this.el.classList;
110
- for (var _i = 0, _a = this.currentClassNames; _i < _a.length; _i++) {
111
- var className = _a[_i];
102
+ let { classList } = this.el;
103
+ for (let className of this.currentClassNames) {
112
104
  classList.remove(className);
113
105
  }
114
- for (var _b = 0, classNames_1 = classNames; _b < classNames_1.length; _b++) {
115
- var className = classNames_1[_b];
106
+ for (let className of classNames) {
116
107
  classList.add(className);
117
108
  }
118
109
  this.currentClassNames = classNames;
119
110
  }
120
- };
121
- Calendar.prototype.setHeight = function (height) {
111
+ }
112
+ setHeight(height) {
122
113
  common.applyStyleProp(this.el, 'height', height);
123
- };
124
- return Calendar;
125
- }(common.CalendarApi));
114
+ }
115
+ }
126
116
 
127
117
  exports.Calendar = Calendar;
128
118
  Object.keys(common).forEach(function (k) {