@fullcalendar/scrollgrid 6.0.0-beta.1 → 6.0.0-beta.2

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.
@@ -1,7 +1,6 @@
1
-
2
- import * as _fullcalendar_common from '@fullcalendar/common';
3
- import { BaseComponent, ScrollGridProps, VNode, ScrollGridSectionConfig, ScrollGridChunkConfig, CssDimValue, ColProps } from '@fullcalendar/common';
4
- import '@fullcalendar/premium-common';
1
+ import { CssDimValue } from '@fullcalendar/core';
2
+ import { BaseComponent, ScrollGridProps, ScrollGridSectionConfig, ScrollGridChunkConfig, ColProps } from '@fullcalendar/core/internal';
3
+ import { VNode } from '@fullcalendar/core/preact';
5
4
 
6
5
  interface ScrollGridState {
7
6
  shrinkWidths: number[];
@@ -32,7 +31,6 @@ declare class ScrollGrid extends BaseComponent<ScrollGridProps, ScrollGridState>
32
31
  private getStickyScrolling;
33
32
  private getScrollSyncersBySection;
34
33
  private getScrollSyncersByColumn;
35
- private stickyScrollings;
36
34
  private scrollSyncersBySection;
37
35
  private scrollSyncersByColumn;
38
36
  private rowUnstableMap;
@@ -63,7 +61,6 @@ declare class ScrollGrid extends BaseComponent<ScrollGridProps, ScrollGridState>
63
61
  };
64
62
  };
65
63
  updateStickyScrolling(): void;
66
- destroyStickyScrolling(): void;
67
64
  updateScrollSyncers(): void;
68
65
  destroyScrollSyncers(): void;
69
66
  getChunkConfigByIndex(index: number): ScrollGridChunkConfig;
@@ -74,10 +71,4 @@ declare class ScrollGrid extends BaseComponent<ScrollGridProps, ScrollGridState>
74
71
  getDims(): number[];
75
72
  }
76
73
 
77
- declare function setScrollFromLeftEdge(el: HTMLElement, scrollLeft: number): void;
78
-
79
- declare const _default: _fullcalendar_common.PluginDef;
80
-
81
-
82
- export default _default;
83
- export { ScrollGrid, setScrollFromLeftEdge };
74
+ export { ScrollGrid };
@@ -1,96 +1,5 @@
1
- /*!
2
- FullCalendar Scheduler v6.0.0-beta.1
3
- Docs & License: https://fullcalendar.io/scheduler
4
- (c) 2022 Adam Shaw
5
- */
6
- import { Emitter, DelayedRunner, removeElement, computeEdges, findElements, translateRect, computeInnerRect, applyStyle, BaseComponent, createRef, setRef, getIsRtlScrollbarOnLeft, createElement, Scroller, isPropsEqual, memoizeArraylike, renderMicroColGroup, RefMap, getScrollGridClassNames, getCanVGrowWithinCell, Fragment, getSectionClassNames, getAllowYScrolling, getSectionHasLiquidHeight, renderChunkContent, memoizeHashlike, config, computeShrinkWidth, getScrollbarWidths, collectFromHash, mapHash, isArraysEqual, sanitizeShrinkWidth, hasShrinkWidth, compareObjs, isColPropsEqual, createPlugin } from '@fullcalendar/common';
7
- import premiumCommonPlugin from '@fullcalendar/premium-common';
8
-
9
- const WHEEL_EVENT_NAMES = 'wheel mousewheel DomMouseScroll MozMousePixelScroll'.split(' ');
10
- /*
11
- ALSO, with the ability to disable touch
12
- */
13
- class ScrollListener {
14
- constructor(el) {
15
- this.el = el;
16
- this.emitter = new Emitter();
17
- this.isScrolling = false;
18
- this.isTouching = false; // user currently has finger down?
19
- this.isRecentlyWheeled = false;
20
- this.isRecentlyScrolled = false;
21
- this.wheelWaiter = new DelayedRunner(this._handleWheelWaited.bind(this));
22
- this.scrollWaiter = new DelayedRunner(this._handleScrollWaited.bind(this));
23
- // Handlers
24
- // ----------------------------------------------------------------------------------------------
25
- this.handleScroll = () => {
26
- this.startScroll();
27
- this.emitter.trigger('scroll', this.isRecentlyWheeled, this.isTouching);
28
- this.isRecentlyScrolled = true;
29
- this.scrollWaiter.request(500);
30
- };
31
- // will fire *before* the scroll event is fired (might not cause a scroll)
32
- this.handleWheel = () => {
33
- this.isRecentlyWheeled = true;
34
- this.wheelWaiter.request(500);
35
- };
36
- // will fire *before* the scroll event is fired (might not cause a scroll)
37
- this.handleTouchStart = () => {
38
- this.isTouching = true;
39
- };
40
- this.handleTouchEnd = () => {
41
- this.isTouching = false;
42
- // if the user ended their touch, and the scroll area wasn't moving,
43
- // we consider this to be the end of the scroll.
44
- if (!this.isRecentlyScrolled) {
45
- this.endScroll(); // won't fire if already ended
46
- }
47
- };
48
- el.addEventListener('scroll', this.handleScroll);
49
- el.addEventListener('touchstart', this.handleTouchStart, { passive: true });
50
- el.addEventListener('touchend', this.handleTouchEnd);
51
- for (let eventName of WHEEL_EVENT_NAMES) {
52
- el.addEventListener(eventName, this.handleWheel);
53
- }
54
- }
55
- destroy() {
56
- let { el } = this;
57
- el.removeEventListener('scroll', this.handleScroll);
58
- el.removeEventListener('touchstart', this.handleTouchStart, { passive: true });
59
- el.removeEventListener('touchend', this.handleTouchEnd);
60
- for (let eventName of WHEEL_EVENT_NAMES) {
61
- el.removeEventListener(eventName, this.handleWheel);
62
- }
63
- }
64
- // Start / Stop
65
- // ----------------------------------------------------------------------------------------------
66
- startScroll() {
67
- if (!this.isScrolling) {
68
- this.isScrolling = true;
69
- this.emitter.trigger('scrollStart', this.isRecentlyWheeled, this.isTouching);
70
- }
71
- }
72
- endScroll() {
73
- if (this.isScrolling) {
74
- this.emitter.trigger('scrollEnd');
75
- this.isScrolling = false;
76
- this.isRecentlyScrolled = true;
77
- this.isRecentlyWheeled = false;
78
- this.scrollWaiter.clear();
79
- this.wheelWaiter.clear();
80
- }
81
- }
82
- _handleScrollWaited() {
83
- this.isRecentlyScrolled = false;
84
- // only end the scroll if not currently touching.
85
- // if touching, the scrolling will end later, on touchend.
86
- if (!this.isTouching) {
87
- this.endScroll(); // won't fire if already ended
88
- }
89
- }
90
- _handleWheelWaited() {
91
- this.isRecentlyWheeled = false;
92
- }
93
- }
1
+ import { computeEdges, removeElement, findElements, translateRect, computeInnerRect, applyStyle, BaseComponent, setRef, getIsRtlScrollbarOnLeft, Scroller, isPropsEqual, Emitter, DelayedRunner, config, isArraysEqual, memoizeArraylike, renderMicroColGroup, RefMap, getScrollGridClassNames, getCanVGrowWithinCell, getSectionClassNames, getAllowYScrolling, getSectionHasLiquidHeight, renderChunkContent, memoizeHashlike, computeShrinkWidth, getScrollbarWidths, collectFromHash, mapHash, sanitizeShrinkWidth, hasShrinkWidth, compareObjs, isColPropsEqual } from '@fullcalendar/core/internal.js';
2
+ import { createRef, createElement, Fragment } from '@fullcalendar/core/preact.js';
94
3
 
95
4
  // TODO: assume the el has no borders?
96
5
  function getScrollCanvasOrigin(scrollEl) {
@@ -162,12 +71,9 @@ function detectRtlScrollSystem() {
162
71
  return system;
163
72
  }
164
73
 
165
- const IS_MS_EDGE = typeof navigator !== 'undefined' && /Edge/.test(navigator.userAgent); // TODO: what about Chromeum-based Edge?
166
74
  const STICKY_SELECTOR = '.fc-sticky';
167
75
  /*
168
- useful beyond the native position:sticky for these reasons:
169
- - support in IE11
170
- - nice centering support
76
+ Goes beyond mere position:sticky, allows horizontal centering
171
77
 
172
78
  REQUIREMENT: fc-sticky elements, if the fc-sticky className is taken away, should NOT have relative or absolute positioning.
173
79
  This is because we attach the coords with JS, and the VDOM might take away the fc-sticky class but doesn't know kill the positioning.
@@ -178,34 +84,13 @@ class StickyScrolling {
178
84
  constructor(scrollEl, isRtl) {
179
85
  this.scrollEl = scrollEl;
180
86
  this.isRtl = isRtl;
181
- this.usingRelative = null;
182
87
  this.updateSize = () => {
183
88
  let { scrollEl } = this;
184
89
  let els = findElements(scrollEl, STICKY_SELECTOR);
185
90
  let elGeoms = this.queryElGeoms(els);
186
91
  let viewportWidth = scrollEl.clientWidth;
187
- let viewportHeight = scrollEl.clientHeight;
188
- if (this.usingRelative) {
189
- let elDestinations = this.computeElDestinations(elGeoms, viewportWidth); // read before prepPositioning
190
- assignRelativePositions(els, elGeoms, elDestinations, viewportWidth, viewportHeight);
191
- }
192
- else {
193
- assignStickyPositions(els, elGeoms, viewportWidth);
194
- }
92
+ assignStickyPositions(els, elGeoms, viewportWidth);
195
93
  };
196
- this.usingRelative =
197
- !getStickySupported() || // IE11
198
- // https://stackoverflow.com/questions/56835658/in-microsoft-edge-sticky-positioning-doesnt-work-when-combined-with-dir-rtl
199
- (IS_MS_EDGE && isRtl);
200
- if (this.usingRelative) {
201
- this.listener = new ScrollListener(scrollEl);
202
- this.listener.emitter.on('scrollEnd', this.updateSize);
203
- }
204
- }
205
- destroy() {
206
- if (this.listener) {
207
- this.listener.destroy();
208
- }
209
94
  }
210
95
  queryElGeoms(els) {
211
96
  let { scrollEl, isRtl } = this;
@@ -238,59 +123,6 @@ class StickyScrolling {
238
123
  }
239
124
  return elGeoms;
240
125
  }
241
- // only for IE
242
- computeElDestinations(elGeoms, viewportWidth) {
243
- let { scrollEl } = this;
244
- let viewportTop = scrollEl.scrollTop;
245
- let viewportLeft = getScrollFromLeftEdge(scrollEl);
246
- let viewportRight = viewportLeft + viewportWidth;
247
- return elGeoms.map((elGeom) => {
248
- let { elWidth, elHeight, parentBound, naturalBound } = elGeom;
249
- let destLeft; // relative to canvas topleft
250
- let destTop; // "
251
- switch (elGeom.textAlign) {
252
- case 'left':
253
- destLeft = viewportLeft;
254
- break;
255
- case 'right':
256
- destLeft = viewportRight - elWidth;
257
- break;
258
- case 'center':
259
- destLeft = (viewportLeft + viewportRight) / 2 - elWidth / 2; /// noooo, use half-width insteadddddddd
260
- break;
261
- }
262
- destLeft = Math.min(destLeft, parentBound.right - elWidth);
263
- destLeft = Math.max(destLeft, parentBound.left);
264
- destTop = viewportTop;
265
- destTop = Math.min(destTop, parentBound.bottom - elHeight);
266
- destTop = Math.max(destTop, naturalBound.top); // better to use natural top for upper bound
267
- return { left: destLeft, top: destTop };
268
- });
269
- }
270
- }
271
- function assignRelativePositions(els, elGeoms, elDestinations, viewportWidth, viewportHeight) {
272
- els.forEach((el, i) => {
273
- let { naturalBound, parentBound } = elGeoms[i];
274
- let parentWidth = parentBound.right - parentBound.left;
275
- let parentHeight = parentBound.bottom - parentBound.bottom;
276
- let left;
277
- let top;
278
- if (parentWidth > viewportWidth ||
279
- parentHeight > viewportHeight) {
280
- left = elDestinations[i].left - naturalBound.left;
281
- top = elDestinations[i].top - naturalBound.top;
282
- }
283
- else { // if parent container can be completely in view, we don't need stickiness
284
- left = '';
285
- top = '';
286
- }
287
- applyStyle(el, {
288
- position: 'relative',
289
- left,
290
- right: -left,
291
- top,
292
- });
293
- });
294
126
  }
295
127
  function assignStickyPositions(els, elGeoms, viewportWidth) {
296
128
  els.forEach((el, i) => {
@@ -311,21 +143,6 @@ function assignStickyPositions(els, elGeoms, viewportWidth) {
311
143
  });
312
144
  });
313
145
  }
314
- let _isStickySupported;
315
- function getStickySupported() {
316
- if (_isStickySupported == null) {
317
- _isStickySupported = computeStickySupported();
318
- }
319
- return _isStickySupported;
320
- }
321
- function computeStickySupported() {
322
- let el = document.createElement('div');
323
- el.style.position = 'sticky';
324
- document.body.appendChild(el);
325
- let val = window.getComputedStyle(el).position;
326
- removeElement(el);
327
- return val === 'sticky';
328
- }
329
146
 
330
147
  class ClippedScroller extends BaseComponent {
331
148
  constructor() {
@@ -393,6 +210,92 @@ class ClippedScroller extends BaseComponent {
393
210
  }
394
211
  }
395
212
 
213
+ const WHEEL_EVENT_NAMES = 'wheel mousewheel DomMouseScroll MozMousePixelScroll'.split(' ');
214
+ /*
215
+ ALSO, with the ability to disable touch
216
+ */
217
+ class ScrollListener {
218
+ constructor(el) {
219
+ this.el = el;
220
+ this.emitter = new Emitter();
221
+ this.isScrolling = false;
222
+ this.isTouching = false; // user currently has finger down?
223
+ this.isRecentlyWheeled = false;
224
+ this.isRecentlyScrolled = false;
225
+ this.wheelWaiter = new DelayedRunner(this._handleWheelWaited.bind(this));
226
+ this.scrollWaiter = new DelayedRunner(this._handleScrollWaited.bind(this));
227
+ // Handlers
228
+ // ----------------------------------------------------------------------------------------------
229
+ this.handleScroll = () => {
230
+ this.startScroll();
231
+ this.emitter.trigger('scroll', this.isRecentlyWheeled, this.isTouching);
232
+ this.isRecentlyScrolled = true;
233
+ this.scrollWaiter.request(500);
234
+ };
235
+ // will fire *before* the scroll event is fired (might not cause a scroll)
236
+ this.handleWheel = () => {
237
+ this.isRecentlyWheeled = true;
238
+ this.wheelWaiter.request(500);
239
+ };
240
+ // will fire *before* the scroll event is fired (might not cause a scroll)
241
+ this.handleTouchStart = () => {
242
+ this.isTouching = true;
243
+ };
244
+ this.handleTouchEnd = () => {
245
+ this.isTouching = false;
246
+ // if the user ended their touch, and the scroll area wasn't moving,
247
+ // we consider this to be the end of the scroll.
248
+ if (!this.isRecentlyScrolled) {
249
+ this.endScroll(); // won't fire if already ended
250
+ }
251
+ };
252
+ el.addEventListener('scroll', this.handleScroll);
253
+ el.addEventListener('touchstart', this.handleTouchStart, { passive: true });
254
+ el.addEventListener('touchend', this.handleTouchEnd);
255
+ for (let eventName of WHEEL_EVENT_NAMES) {
256
+ el.addEventListener(eventName, this.handleWheel);
257
+ }
258
+ }
259
+ destroy() {
260
+ let { el } = this;
261
+ el.removeEventListener('scroll', this.handleScroll);
262
+ el.removeEventListener('touchstart', this.handleTouchStart, { passive: true });
263
+ el.removeEventListener('touchend', this.handleTouchEnd);
264
+ for (let eventName of WHEEL_EVENT_NAMES) {
265
+ el.removeEventListener(eventName, this.handleWheel);
266
+ }
267
+ }
268
+ // Start / Stop
269
+ // ----------------------------------------------------------------------------------------------
270
+ startScroll() {
271
+ if (!this.isScrolling) {
272
+ this.isScrolling = true;
273
+ this.emitter.trigger('scrollStart', this.isRecentlyWheeled, this.isTouching);
274
+ }
275
+ }
276
+ endScroll() {
277
+ if (this.isScrolling) {
278
+ this.emitter.trigger('scrollEnd');
279
+ this.isScrolling = false;
280
+ this.isRecentlyScrolled = true;
281
+ this.isRecentlyWheeled = false;
282
+ this.scrollWaiter.clear();
283
+ this.wheelWaiter.clear();
284
+ }
285
+ }
286
+ _handleScrollWaited() {
287
+ this.isRecentlyScrolled = false;
288
+ // only end the scroll if not currently touching.
289
+ // if touching, the scrolling will end later, on touchend.
290
+ if (!this.isTouching) {
291
+ this.endScroll(); // won't fire if already ended
292
+ }
293
+ }
294
+ _handleWheelWaited() {
295
+ this.isRecentlyWheeled = false;
296
+ }
297
+ }
298
+
396
299
  class ScrollSyncer {
397
300
  constructor(isVertical, scrollEls) {
398
301
  this.isVertical = isVertical;
@@ -463,6 +366,7 @@ class ScrollSyncer {
463
366
  }
464
367
  }
465
368
 
369
+ config.SCROLLGRID_RESIZE_INTERVAL = 500;
466
370
  /*
467
371
  TODO: make <ScrollGridSection> subcomponent
468
372
  NOTE: doesn't support collapsibleWidth (which is sortof a hack anyway)
@@ -476,7 +380,6 @@ class ScrollGrid extends BaseComponent {
476
380
  // doesn't hold non-scrolling els used just for padding
477
381
  this.scrollerElRefs = new RefMap(this._handleScrollerEl.bind(this));
478
382
  this.chunkElRefs = new RefMap(this._handleChunkEl.bind(this));
479
- this.stickyScrollings = [];
480
383
  this.scrollSyncersBySection = {};
481
384
  this.scrollSyncersByColumn = {};
482
385
  // for row-height-syncing
@@ -616,7 +519,7 @@ class ScrollGrid extends BaseComponent {
616
519
  }, content);
617
520
  }
618
521
  componentDidMount() {
619
- this.getStickyScrolling = memoizeArraylike(initStickyScrolling, null, destroyStickyScrolling);
522
+ this.getStickyScrolling = memoizeArraylike(initStickyScrolling);
620
523
  this.getScrollSyncersBySection = memoizeHashlike(initScrollSyncer.bind(this, true), null, destroyScrollSyncer);
621
524
  this.getScrollSyncersByColumn = memoizeHashlike(initScrollSyncer.bind(this, false), null, destroyScrollSyncer);
622
525
  this.updateScrollSyncers();
@@ -630,7 +533,6 @@ class ScrollGrid extends BaseComponent {
630
533
  }
631
534
  componentWillUnmount() {
632
535
  this.context.removeResizeHandler(this.handleSizing);
633
- this.destroyStickyScrolling();
634
536
  this.destroyScrollSyncers();
635
537
  }
636
538
  allowSizing() {
@@ -790,12 +692,8 @@ class ScrollGrid extends BaseComponent {
790
692
  updateStickyScrolling() {
791
693
  let { isRtl } = this.context;
792
694
  let argsByKey = this.scrollerElRefs.getAll().map((scrollEl) => [scrollEl, isRtl]);
793
- let stickyScrollings = this.getStickyScrolling(argsByKey);
794
- stickyScrollings.forEach((stickyScrolling) => stickyScrolling.updateSize());
795
- this.stickyScrollings = stickyScrollings;
796
- }
797
- destroyStickyScrolling() {
798
- this.stickyScrollings.forEach(destroyStickyScrolling);
695
+ this.getStickyScrolling(argsByKey)
696
+ .forEach((stickyScrolling) => stickyScrolling.updateSize());
799
697
  }
800
698
  updateScrollSyncers() {
801
699
  let [sectionCnt, chunksPerSection] = this.getDims();
@@ -928,18 +826,5 @@ function destroyScrollSyncer(scrollSyncer) {
928
826
  function initStickyScrolling(scrollEl, isRtl) {
929
827
  return new StickyScrolling(scrollEl, isRtl);
930
828
  }
931
- function destroyStickyScrolling(stickyScrolling) {
932
- stickyScrolling.destroy();
933
- }
934
-
935
- var main = createPlugin({
936
- deps: [
937
- premiumCommonPlugin,
938
- ],
939
- scrollGridImpl: ScrollGrid,
940
- });
941
- config.SCROLLGRID_RESIZE_INTERVAL = 500;
942
829
 
943
- export default main;
944
- export { ScrollGrid, setScrollFromLeftEdge };
945
- //# sourceMappingURL=main.js.map
830
+ export { ScrollGrid };
package/package.json CHANGED
@@ -1,25 +1,19 @@
1
1
  {
2
2
  "name": "@fullcalendar/scrollgrid",
3
- "version": "6.0.0-beta.1",
4
- "title": "FullCalendar ScrollGrid Plugin",
5
- "description": "Tabular data chunked into scrollable panes",
6
- "docs": "https://fullcalendar.io/docs/scheduler",
7
- "dependencies": {
8
- "@fullcalendar/common": "6.0.0-beta.1",
9
- "@fullcalendar/premium-common": "6.0.0-beta.1",
10
- "tslib": "^2.1.0"
11
- },
12
- "main": "main.cjs.js",
13
- "module": "main.js",
14
- "types": "main.d.ts",
15
- "jsdelivr": "main.global.min.js",
16
- "browserGlobal": "FullCalendarScrollGrid",
17
- "homepage": "https://fullcalendar.io/scheduler",
3
+ "version": "6.0.0-beta.2",
4
+ "keywords": [
5
+ "calendar",
6
+ "event",
7
+ "full-sized"
8
+ ],
9
+ "homepage": "https://fullcalendar.io/premium",
10
+ "docs": "https://fullcalendar.io/docs/premium",
18
11
  "bugs": "https://fullcalendar.io/reporting-bugs",
19
12
  "repository": {
20
13
  "type": "git",
21
14
  "url": "https://github.com/fullcalendar/fullcalendar-scheduler.git",
22
- "homepage": "https://github.com/fullcalendar/fullcalendar-scheduler"
15
+ "homepage": "https://github.com/fullcalendar/fullcalendar-scheduler",
16
+ "directory": "packages/scrollgrid"
23
17
  },
24
18
  "license": "SEE LICENSE IN LICENSE.md",
25
19
  "author": {
@@ -27,7 +21,37 @@
27
21
  "email": "arshaw@arshaw.com",
28
22
  "url": "http://arshaw.com/"
29
23
  },
30
- "devDependencies": {
31
- "@fullcalendar/core-preact": "6.0.0-beta.1"
24
+ "copyright": "2022 Adam Shaw",
25
+ "title": "FullCalendar ScrollGrid Plugin",
26
+ "description": "Tabular data chunked into scrollable panes",
27
+ "dependencies": {
28
+ "@fullcalendar/premium-common": "6.0.0-beta.2"
29
+ },
30
+ "peerDependencies": {
31
+ "@fullcalendar/core": "6.0.0-beta.2"
32
+ },
33
+ "type": "module",
34
+ "main": "./index.cjs",
35
+ "module": "./index.js",
36
+ "types": "./index.d.ts",
37
+ "unpkg": "./index.global.min.js",
38
+ "jsdelvr": "./index.global.min.js",
39
+ "exports": {
40
+ "./package.json": "./package.json",
41
+ "./index.cjs": "./index.cjs",
42
+ "./index.js": "./index.js",
43
+ ".": {
44
+ "require": "./index.cjs",
45
+ "import": "./index.js",
46
+ "types": "./index.d.ts",
47
+ "default": "./index.global.js"
48
+ },
49
+ "./internal.cjs": "./internal.cjs",
50
+ "./internal.js": "./internal.js",
51
+ "./internal": {
52
+ "require": "./internal.cjs",
53
+ "import": "./internal.js",
54
+ "types": "./internal.d.ts"
55
+ }
32
56
  }
33
57
  }
@@ -1,6 +0,0 @@
1
- /*!
2
- FullCalendar Scheduler v6.0.0-beta.1
3
- Docs & License: https://fullcalendar.io/scheduler
4
- (c) 2022 Adam Shaw
5
- */
6
- var FullCalendarScrollGrid=function(e,t,l){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(FullCalendarPremiumCommon);const r="wheel mousewheel DomMouseScroll MozMousePixelScroll".split(" ");class o{constructor(e){this.el=e,this.emitter=new t.Emitter,this.isScrolling=!1,this.isTouching=!1,this.isRecentlyWheeled=!1,this.isRecentlyScrolled=!1,this.wheelWaiter=new t.DelayedRunner(this._handleWheelWaited.bind(this)),this.scrollWaiter=new t.DelayedRunner(this._handleScrollWaited.bind(this)),this.handleScroll=()=>{this.startScroll(),this.emitter.trigger("scroll",this.isRecentlyWheeled,this.isTouching),this.isRecentlyScrolled=!0,this.scrollWaiter.request(500)},this.handleWheel=()=>{this.isRecentlyWheeled=!0,this.wheelWaiter.request(500)},this.handleTouchStart=()=>{this.isTouching=!0},this.handleTouchEnd=()=>{this.isTouching=!1,this.isRecentlyScrolled||this.endScroll()},e.addEventListener("scroll",this.handleScroll),e.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),e.addEventListener("touchend",this.handleTouchEnd);for(let t of r)e.addEventListener(t,this.handleWheel)}destroy(){let{el:e}=this;e.removeEventListener("scroll",this.handleScroll),e.removeEventListener("touchstart",this.handleTouchStart,{passive:!0}),e.removeEventListener("touchend",this.handleTouchEnd);for(let t of r)e.removeEventListener(t,this.handleWheel)}startScroll(){this.isScrolling||(this.isScrolling=!0,this.emitter.trigger("scrollStart",this.isRecentlyWheeled,this.isTouching))}endScroll(){this.isScrolling&&(this.emitter.trigger("scrollEnd"),this.isScrolling=!1,this.isRecentlyScrolled=!0,this.isRecentlyWheeled=!1,this.scrollWaiter.clear(),this.wheelWaiter.clear())}_handleScrollWaited(){this.isRecentlyScrolled=!1,this.isTouching||this.endScroll()}_handleWheelWaited(){this.isRecentlyWheeled=!1}}function n(e){let t=e.scrollLeft;if("rtl"===window.getComputedStyle(e).direction)switch(a()){case"negative":t*=-1;case"reverse":t=e.scrollWidth-t-e.clientWidth}return t}function h(e,t){if("rtl"===window.getComputedStyle(e).direction)switch(a()){case"reverse":t=e.scrollWidth-t;break;case"negative":t=-(e.scrollWidth-t)}e.scrollLeft=t}let c;function a(){return c||(c=function(){let e,l=document.createElement("div");l.style.position="absolute",l.style.top="-1000px",l.style.width="1px",l.style.height="1px",l.style.overflow="scroll",l.style.direction="rtl",l.style.fontSize="100px",l.innerHTML="A",document.body.appendChild(l),l.scrollLeft>0?e="positive":(l.scrollLeft=1,e=l.scrollLeft>0?"reverse":"negative");return t.removeElement(l),e}())}const d="undefined"!=typeof navigator&&/Edge/.test(navigator.userAgent);class u{constructor(e,l){this.scrollEl=e,this.isRtl=l,this.usingRelative=null,this.updateSize=()=>{let{scrollEl:e}=this,l=t.findElements(e,".fc-sticky"),i=this.queryElGeoms(l),s=e.clientWidth,r=e.clientHeight;if(this.usingRelative){!function(e,l,i,s,r){e.forEach(((e,o)=>{let n,h,{naturalBound:c,parentBound:a}=l[o],d=a.right-a.left,u=a.bottom-a.bottom;d>s||u>r?(n=i[o].left-c.left,h=i[o].top-c.top):(n="",h=""),t.applyStyle(e,{position:"relative",left:n,right:-n,top:h})}))}(l,i,this.computeElDestinations(i,s),s,r)}else!function(e,l,i){e.forEach(((e,s)=>{let r,{textAlign:o,elWidth:n,parentBound:h}=l[s],c=h.right-h.left;r="center"===o&&c>i?(i-n)/2:"",t.applyStyle(e,{left:r,right:r,top:0})}))}(l,i,s)},this.usingRelative=!function(){null==f&&(f=function(){let e=document.createElement("div");e.style.position="sticky",document.body.appendChild(e);let l=window.getComputedStyle(e).position;return t.removeElement(e),"sticky"===l}());return f}()||d&&l,this.usingRelative&&(this.listener=new o(e),this.listener.emitter.on("scrollEnd",this.updateSize))}destroy(){this.listener&&this.listener.destroy()}queryElGeoms(e){let{scrollEl:l,isRtl:i}=this,s=function(e){let l=e.getBoundingClientRect(),i=t.computeEdges(e);return{left:l.left+i.borderLeft+i.scrollbarLeft-n(e),top:l.top+i.borderTop-e.scrollTop}}(l),r=[];for(let l of e){let e=t.translateRect(t.computeInnerRect(l.parentNode,!0,!0),-s.left,-s.top),o=l.getBoundingClientRect(),n=window.getComputedStyle(l),h=window.getComputedStyle(l.parentNode).textAlign,c=null;"start"===h?h=i?"right":"left":"end"===h&&(h=i?"left":"right"),"sticky"!==n.position&&(c=t.translateRect(o,-s.left-(parseFloat(n.left)||0),-s.top-(parseFloat(n.top)||0))),r.push({parentBound:e,naturalBound:c,elWidth:o.width,elHeight:o.height,textAlign:h})}return r}computeElDestinations(e,t){let{scrollEl:l}=this,i=l.scrollTop,s=n(l),r=s+t;return e.map((e=>{let t,l,{elWidth:o,elHeight:n,parentBound:h,naturalBound:c}=e;switch(e.textAlign){case"left":t=s;break;case"right":t=r-o;break;case"center":t=(s+r)/2-o/2}return t=Math.min(t,h.right-o),t=Math.max(t,h.left),l=i,l=Math.min(l,h.bottom-n),l=Math.max(l,c.top),{left:t,top:l}}))}}let f;class g extends t.BaseComponent{constructor(){super(...arguments),this.elRef=t.createRef(),this.state={xScrollbarWidth:0,yScrollbarWidth:0},this.handleScroller=e=>{this.scroller=e,t.setRef(this.props.scrollerRef,e)},this.handleSizing=()=>{let{props:e}=this;"scroll-hidden"===e.overflowY&&this.setState({yScrollbarWidth:this.scroller.getYScrollbarWidth()}),"scroll-hidden"===e.overflowX&&this.setState({xScrollbarWidth:this.scroller.getXScrollbarWidth()})}}render(){let{props:e,state:l,context:i}=this,s=i.isRtl&&t.getIsRtlScrollbarOnLeft(),r=0,o=0,n=0;return"scroll-hidden"===e.overflowX&&(n=l.xScrollbarWidth),"scroll-hidden"===e.overflowY&&null!=l.yScrollbarWidth&&(s?r=l.yScrollbarWidth:o=l.yScrollbarWidth),t.createElement("div",{ref:this.elRef,className:"fc-scroller-harness"+(e.liquid?" fc-scroller-harness-liquid":"")},t.createElement(t.Scroller,{ref:this.handleScroller,elRef:this.props.scrollerElRef,overflowX:"scroll-hidden"===e.overflowX?"scroll":e.overflowX,overflowY:"scroll-hidden"===e.overflowY?"scroll":e.overflowY,overcomeLeft:r,overcomeRight:o,overcomeBottom:n,maxHeight:"number"==typeof e.maxHeight?e.maxHeight+("scroll-hidden"===e.overflowX?l.xScrollbarWidth:0):"",liquid:e.liquid,liquidIsAbsolute:!0},e.children))}componentDidMount(){this.handleSizing(),this.context.addResizeHandler(this.handleSizing)}componentDidUpdate(e){t.isPropsEqual(e,this.props)||this.handleSizing()}componentWillUnmount(){this.context.removeResizeHandler(this.handleSizing)}needsXScrolling(){return this.scroller.needsXScrolling()}needsYScrolling(){return this.scroller.needsYScrolling()}}class p{constructor(e,t){this.isVertical=e,this.scrollEls=t,this.isPaused=!1,this.scrollListeners=t.map((e=>this.bindScroller(e)))}destroy(){for(let e of this.scrollListeners)e.destroy()}bindScroller(e){let{scrollEls:t,isVertical:l}=this,i=new o(e);return i.emitter.on("scroll",((i,s)=>{if(!this.isPaused&&((!this.masterEl||this.masterEl!==e&&(i||s))&&this.assignMaster(e),this.masterEl===e))for(let i of t)i!==e&&(l?i.scrollTop=e.scrollTop:i.scrollLeft=e.scrollLeft)})),i.emitter.on("scrollEnd",(()=>{this.masterEl===e&&(this.masterEl=null)})),i}assignMaster(e){this.masterEl=e;for(let t of this.scrollListeners)t.el!==e&&t.endScroll()}forceScrollLeft(e){this.isPaused=!0;for(let t of this.scrollListeners)h(t.el,e);this.isPaused=!1}forceScrollTop(e){this.isPaused=!0;for(let t of this.scrollListeners)t.el.scrollTop=e;this.isPaused=!1}}class S extends t.BaseComponent{constructor(){super(...arguments),this.compileColGroupStats=t.memoizeArraylike(w,b),this.renderMicroColGroups=t.memoizeArraylike(t.renderMicroColGroup),this.clippedScrollerRefs=new t.RefMap,this.scrollerElRefs=new t.RefMap(this._handleScrollerEl.bind(this)),this.chunkElRefs=new t.RefMap(this._handleChunkEl.bind(this)),this.stickyScrollings=[],this.scrollSyncersBySection={},this.scrollSyncersByColumn={},this.rowUnstableMap=new Map,this.rowInnerMaxHeightMap=new Map,this.anyRowHeightsChanged=!1,this.recentSizingCnt=0,this.state={shrinkWidths:[],forceYScrollbars:!1,forceXScrollbars:!1,scrollerClientWidths:{},scrollerClientHeights:{},sectionRowMaxHeights:[]},this.handleSizing=(e,t)=>{if(!this.allowSizing())return;t||(this.anyRowHeightsChanged=!0);let l={};(e||!t&&!this.rowUnstableMap.size)&&(l.sectionRowMaxHeights=this.computeSectionRowMaxHeights()),this.setState(Object.assign(Object.assign({shrinkWidths:this.computeShrinkWidths()},this.computeScrollerDims()),l),(()=>{this.rowUnstableMap.size||this.updateStickyScrolling()}))},this.handleRowHeightChange=(e,t)=>{let{rowUnstableMap:l,rowInnerMaxHeightMap:i}=this;if(t){l.delete(e);let t=y(e);i.has(e)&&i.get(e)===t||(i.set(e,t),this.anyRowHeightsChanged=!0),!l.size&&this.anyRowHeightsChanged&&(this.anyRowHeightsChanged=!1,this.setState({sectionRowMaxHeights:this.computeSectionRowMaxHeights()}))}else l.set(e,!0)}}render(){let{props:e,state:l,context:i}=this,{shrinkWidths:s}=l,r=this.compileColGroupStats(e.colGroups.map((e=>[e]))),o=this.renderMicroColGroups(r.map(((e,t)=>[e.cols,s[t]]))),n=t.getScrollGridClassNames(e.liquid,i);this.getDims();let h,c=e.sections,a=c.length,d=0,u=[],f=[],g=[];for(;d<a&&"header"===(h=c[d]).type;)u.push(this.renderSection(h,d,r,o,l.sectionRowMaxHeights,!0)),d+=1;for(;d<a&&"body"===(h=c[d]).type;)f.push(this.renderSection(h,d,r,o,l.sectionRowMaxHeights,!1)),d+=1;for(;d<a&&"footer"===(h=c[d]).type;)g.push(this.renderSection(h,d,r,o,l.sectionRowMaxHeights,!0)),d+=1;const p=!t.getCanVGrowWithinCell(),S={role:"rowgroup"};return t.createElement("table",{ref:e.elRef,role:"grid",className:n.join(" ")},function(e,l){let i=e.map(((e,i)=>{let s=e.width;return"shrink"===s&&(s=e.totalColWidth+t.sanitizeShrinkWidth(l[i])+1),t.createElement("col",{style:{width:s}})}));return t.createElement("colgroup",{},...i)}(r,s),Boolean(!p&&u.length)&&t.createElement("thead",S,...u),Boolean(!p&&f.length)&&t.createElement("tbody",S,...f),Boolean(!p&&g.length)&&t.createElement("tfoot",S,...g),p&&t.createElement("tbody",S,...u,...f,...g))}renderSection(e,l,i,s,r,o){return"outerContent"in e?t.createElement(t.Fragment,{key:e.key},e.outerContent):t.createElement("tr",{key:e.key,role:"presentation",className:t.getSectionClassNames(e,this.props.liquid).join(" ")},e.chunks.map(((t,n)=>this.renderChunk(e,l,i[n],s[n],t,n,(r[l]||[])[n]||[],o))))}renderChunk(e,l,i,s,r,o,n,h){if("outerContent"in r)return t.createElement(t.Fragment,{key:r.key},r.outerContent);let{state:c}=this,{scrollerClientWidths:a,scrollerClientHeights:d}=c,[u,f]=this.getDims(),p=l*f+o,S=o===(!this.context.isRtl||t.getIsRtlScrollbarOnLeft()?f-1:0),m=l===u-1,y=m&&c.forceXScrollbars,R=S&&c.forceYScrollbars,w=i&&i.allowXScrolling,E=t.getAllowYScrolling(this.props,e),C=t.getSectionHasLiquidHeight(this.props,e),b=e.expandRows&&C,W=i&&i.totalColMinWidth||"",k=t.renderChunkContent(e,r,{tableColGroupNode:s,tableMinWidth:W,clientWidth:void 0!==a[p]?a[p]:null,clientHeight:void 0!==d[p]?d[p]:null,expandRows:b,syncRowHeights:Boolean(e.syncRowHeights),rowSyncHeights:n,reportRowHeightChange:this.handleRowHeightChange},h),v=y?m?"scroll":"scroll-hidden":w?m?"auto":"scroll-hidden":"hidden",M=R?S?"scroll":"scroll-hidden":E?S?"auto":"scroll-hidden":"hidden";return k=t.createElement(g,{ref:this.clippedScrollerRefs.createRef(p),scrollerElRef:this.scrollerElRefs.createRef(p),overflowX:v,overflowY:M,liquid:C,maxHeight:e.maxHeight},k),t.createElement(h?"th":"td",{key:r.key,ref:this.chunkElRefs.createRef(p),role:"presentation"},k)}componentDidMount(){this.getStickyScrolling=t.memoizeArraylike(v,null,M),this.getScrollSyncersBySection=t.memoizeHashlike(W.bind(this,!0),null,k),this.getScrollSyncersByColumn=t.memoizeHashlike(W.bind(this,!1),null,k),this.updateScrollSyncers(),this.handleSizing(!1),this.context.addResizeHandler(this.handleSizing)}componentDidUpdate(e,t){this.updateScrollSyncers(),this.handleSizing(!1,t.sectionRowMaxHeights!==this.state.sectionRowMaxHeights)}componentWillUnmount(){this.context.removeResizeHandler(this.handleSizing),this.destroyStickyScrolling(),this.destroyScrollSyncers()}allowSizing(){let e=new Date;return!this.lastSizingDate||e.valueOf()>this.lastSizingDate.valueOf()+t.config.SCROLLGRID_RESIZE_INTERVAL?(this.lastSizingDate=e,this.recentSizingCnt=0,!0):(this.recentSizingCnt+=1)<=10}computeShrinkWidths(){let e=this.compileColGroupStats(this.props.colGroups.map((e=>[e]))),[l,i]=this.getDims(),s=l*i,r=[];return e.forEach(((e,l)=>{if(e.hasShrinkCol){let e=this.chunkElRefs.collect(l,s,i);r[l]=t.computeShrinkWidth(e)}})),r}computeSectionRowMaxHeights(){let e=new Map,[l,i]=this.getDims(),s=[];for(let r=0;r<l;r+=1){let l=this.props.sections[r],o=[];if(l&&l.syncRowHeights){let s=[];for(let l=0;l<i;l+=1){let o=r*i+l,n=[],h=this.chunkElRefs.currentMap[o];n=h?t.findElements(h,".fc-scrollgrid-sync-table tr").map((t=>{let l=y(t);return e.set(t,l),l})):[],s.push(n)}let n=s[0].length,h=!0;for(let e=1;e<i;e+=1){if(!(l.chunks[e]&&void 0!==l.chunks[e].outerContent)&&s[e].length!==n){h=!1;break}}if(h){for(let e=0;e<i;e+=1)o.push([]);for(let e=0;e<n;e+=1){let t=[];for(let l=0;l<i;l+=1){let i=s[l][e];null!=i&&t.push(i)}let l=Math.max(...t);for(let e=0;e<i;e+=1)o[e].push(l)}}else{let e=[];for(let t=0;t<i;t+=1)e.push(m(s[t])+s[t].length);let t=Math.max(...e);for(let e=0;e<i;e+=1){let l=s[e].length,i=t-l,r=Math.floor(i/l),n=i-r*(l-1),h=[],c=0;for(c<l&&(h.push(n),c+=1);c<l;)h.push(r),c+=1;o.push(h)}}}s.push(o)}return this.rowInnerMaxHeightMap=e,s}computeScrollerDims(){let e=t.getScrollbarWidths(),[l,i]=this.getDims(),s=!this.context.isRtl||t.getIsRtlScrollbarOnLeft()?i-1:0,r=l-1,o=this.clippedScrollerRefs.currentMap,n=this.scrollerElRefs.currentMap,h=!1,c=!1,a={},d={};for(let e=0;e<l;e+=1){let t=o[e*i+s];if(t&&t.needsYScrolling()){h=!0;break}}for(let e=0;e<i;e+=1){let t=o[r*i+e];if(t&&t.needsXScrolling()){c=!0;break}}for(let t=0;t<l;t+=1)for(let l=0;l<i;l+=1){let o=t*i+l,u=n[o];if(u){let i=u.parentNode;a[o]=Math.floor(i.getBoundingClientRect().width-(l===s&&h?e.y:0)),d[o]=Math.floor(i.getBoundingClientRect().height-(t===r&&c?e.x:0))}}return{forceYScrollbars:h,forceXScrollbars:c,scrollerClientWidths:a,scrollerClientHeights:d}}updateStickyScrolling(){let{isRtl:e}=this.context,t=this.scrollerElRefs.getAll().map((t=>[t,e])),l=this.getStickyScrolling(t);l.forEach((e=>e.updateSize())),this.stickyScrollings=l}destroyStickyScrolling(){this.stickyScrollings.forEach(M)}updateScrollSyncers(){let[e,l]=this.getDims(),i=e*l,s={},r={},o=this.scrollerElRefs.currentMap;for(let i=0;i<e;i+=1){let e=i*l,r=e+l;s[i]=t.collectFromHash(o,e,r,1)}for(let e=0;e<l;e+=1)r[e]=this.scrollerElRefs.collect(e,i,l);this.scrollSyncersBySection=this.getScrollSyncersBySection(s),this.scrollSyncersByColumn=this.getScrollSyncersByColumn(r)}destroyScrollSyncers(){t.mapHash(this.scrollSyncersBySection,k),t.mapHash(this.scrollSyncersByColumn,k)}getChunkConfigByIndex(e){let t=this.getDims()[1],l=Math.floor(e/t),i=e%t,s=this.props.sections[l];return s&&s.chunks[i]}forceScrollLeft(e,t){let l=this.scrollSyncersByColumn[e];l&&l.forceScrollLeft(t)}forceScrollTop(e,t){let l=this.scrollSyncersBySection[e];l&&l.forceScrollTop(t)}_handleChunkEl(e,l){let i=this.getChunkConfigByIndex(parseInt(l,10));i&&t.setRef(i.elRef,e)}_handleScrollerEl(e,l){let i=this.getChunkConfigByIndex(parseInt(l,10));i&&t.setRef(i.scrollerElRef,e)}getDims(){let e=this.props.sections.length;return[e,e?this.props.sections[0].chunks.length:0]}}function m(e){let t=0;for(let l of e)t+=l;return t}function y(e){let l=t.findElements(e,".fc-scrollgrid-sync-inner").map(R);return l.length?Math.max(...l):0}function R(e){return e.offsetHeight}function w(e){let l=E(e.cols,"width"),i=E(e.cols,"minWidth"),s=t.hasShrinkWidth(e.cols);return{hasShrinkCol:s,totalColWidth:l,totalColMinWidth:i,allowXScrolling:"shrink"!==e.width&&Boolean(l||i||s),cols:e.cols,width:e.width}}function E(e,t){let l=0;for(let i of e){let e=i[t];"number"==typeof e&&(l+=e*(i.span||1))}return l}S.addStateEquality({shrinkWidths:t.isArraysEqual,scrollerClientWidths:t.isPropsEqual,scrollerClientHeights:t.isPropsEqual});const C={cols:t.isColPropsEqual};function b(e,l){return t.compareObjs(e,l,C)}function W(e,...t){return new p(e,t)}function k(e){e.destroy()}function v(e,t){return new u(e,t)}function M(e){e.destroy()}var x=t.createPlugin({deps:[s.default],scrollGridImpl:S});return t.config.SCROLLGRID_RESIZE_INTERVAL=500,t.globalPlugins.push(x),e.ScrollGrid=S,e.default=x,e.setScrollFromLeftEdge=h,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar);